Unity 3D UWP构建失败:找不到System.Xml [英] Unity 3D UWP build fails: System.Xml cannot be found

查看:199
本文介绍了Unity 3D UWP构建失败:找不到System.Xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为UWP构建我的项目,具体来说就是HoloLens.我从网上获取XML数据,并使用NewtonSoft.JsonConvert.SerializeXmlNode(XmlNode节点)(返回字符串)对其进行解析.以下是您需要了解的内容和我已经尝试过的内容的列表:

I am trying to build my project for UWP, HoloLens to be specific. I am getting XML data from the web and parse that using NewtonSoft.JsonConvert.SerializeXmlNode (XmlNode node) (returns string). Here's a list of stuff you need to know and stuff that I tried already:

我的Unity版本是2018.1.3f1,脚本运行时版本是.NET 4,x等效,脚本后端是Mono,API Comp. Lvl也是.NET 4.x.

My Unity version is 2018.1.3f1, Scripting Runtime Version is .NET 4,x Equivalent, Scripting Backend is Mono, API Comp. Lvl is .NET 4.x as well.

确切的错误消息:Assets \ Scripts \ RestManager.cs(62,23):错误CS7069:对"XmlNode"类型的引用声称它在"System.Xml"中定义,但找不到

The exact error message: Assets\Scripts\RestManager.cs(62,23): error CS7069: Reference to type 'XmlNode' claims it is defined in 'System.Xml', but it could not be found

我仔细检查了必要的包含项,还检查了此处描述的类似错误: https ://github.com/OmniSharp/omnisharp-vscode/issues/1986

I double checked the necessary includes and also checked for a similar error described here: https://github.com/OmniSharp/omnisharp-vscode/issues/1986

我想做的事在独立版本和编辑器中都可以使用.

What I want to do works both in a standalone build and the editor.

非常感谢您的帮助!

-----更新-----

----- Update -----

嘿,

我仍在尝试使其工作,并且在我最后一次尝试将该软件包添加到从Unity构建的基于XAML的软件包中之后,出现了这些错误:

I am still trying to get this to work and these errors showed up after my last attempt to add the package to a XAML-based built from Unity:

Install-Package:NU1107:检测到System.Collections的版本冲突.直接从项目中引用该软件包以解决此问题. HoloEPA-> Microsoft.NETCore.UniversalWindowsPlatform 5.0.0-> System.Net.Sockets 4.0.0-> runtime.win.System.Net.Sockets 4.3.0-> System.Collections(> = 4.3.0) HoloEPA-> Microsoft.NETCore.UniversalWindowsPlatform 5.0.0-> Microsoft.NETCore.Runtime 1.0.0-> Microsoft.NETCore.Runtime.CoreCLR-arm 1.0.0-> System.Collections(= 4.0.10). 在第1行:char:1 +安装软件包System.Xml.XmlDocument-版本4.3.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ + CategoryInfo:未指定:(:) [Install-Package],异常 + FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : NU1107: Version conflict detected for System.Collections. Reference the package directly from the project to resolve this issue. HoloEPA -> Microsoft.NETCore.UniversalWindowsPlatform 5.0.0 -> System.Net.Sockets 4.0.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Collections (>= 4.3.0) HoloEPA -> Microsoft.NETCore.UniversalWindowsPlatform 5.0.0 -> Microsoft.NETCore.Runtime 1.0.0 -> Microsoft.NETCore.Runtime.CoreCLR-arm 1.0.0 -> System.Collections (= 4.0.10). At line:1 char:1 + Install-Package System.Xml.XmlDocument -Version 4.3.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package:软件包还原失败.回滚"HoloEPA"的软件包更改. 在第1行:char:1 +安装软件包System.Xml.XmlDocument-版本4.3.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ + CategoryInfo:未指定:(:) [Install-Package],异常 + FullyQualifiedErrorId:NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package restore failed. Rolling back package changes for 'HoloEPA'. At line:1 char:1 + Install-Package System.Xml.XmlDocument -Version 4.3.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

推荐答案

XmlNode不属于.NET Core(由UWP使用).它可以在编辑器或独立版本中使用,因为它们使用的是.NET的不同版本(取决于您的Unity版本,它可能使用的是Mono或.NET 2.X或4.X).

XmlNode is not part of .NET Core (which is used by UWP). It works in the editor or standalone builds because they are using a different version of .NET (depending on your version of Unity, it could be using Mono or .NET 2.X or 4.X).

使用NuGet将此程序包添加到您的Visual Studio项目中,并您将可以再次使用XmlNode.程序集将按预期在System.Xml命名空间下定义XmlNode类.

Add this package to your Visual Studio project using NuGet, and you will be able to use XmlNode again. This assembly will define the XmlNode class under the System.Xml namespace, as expected.

这篇关于Unity 3D UWP构建失败:找不到System.Xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆