本文介绍了如何在Mono中使用XDocument类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 7上的Unity3D项目内使用XDocument类.

I'm trying to use XDocument class inside a Unity3D project on Windows 7.

我做了以下事情:

  • 将参考System.Xml.Linq添加到了Mono项目.
  • 包括名称空间:

  • added the reference System.Xml.Linq to the Mono project.
  • included the namespace:

using System.Xml.Linq;

  • 将目标框架设置为:Mono/.NET 3.5
  • 清理并重建项目
  • set the target framework to: Mono/.NET 3.5
  • clean and rebuild the project
  • 但仍然Unity3D对此有所抱怨.这是控制台中的错误输出:

    But still Unity3D complains about it. Here's the error output in the console:

    有什么主意吗?

    推荐答案

    已对此进行了讨论 很多 时间 之前,unity3d.com/questions/46039/can-not-reference-systemxmllinq.html"rel =" nofollow noreferrer>,但是这些答案很少.

    This has been discussed many times before, but few of these answers are complete.

    如前所述,Unity3d最多仅支持.NET 2.0版,并且System.Xml.Linq似乎是在.NET 3.5中引入的,除了它没有在 Unity3d兼容性列表随处可见.

    As has been said before, Unity3d only supports up to .NET version 2.0, and it seems System.Xml.Linq was introduced in .NET 3.5, besides the fact that it is not listed on the Unity3d compatibility list anywhere.

    另一种可能的解决方案是将DLL自己添加到Unity编辑器中,如下所示:

    Another possible solution is to add the DLL yourself into the Unity Editor as shown:

    如果这些都不为您带来好运,那么恐怕您不走运.

    If none of these yield ANY luck for you, then I'm afraid you are out of luck.

    这篇关于如何在Mono中使用XDocument类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    09-02 19:26