Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unity3d 类型或命名空间名称`Xml';命名空间“System.Security.Cryptography';_Unity3d_Unityscript - Fatal编程技术网

Unity3d 类型或命名空间名称`Xml';命名空间“System.Security.Cryptography';

Unity3d 类型或命名空间名称`Xml';命名空间“System.Security.Cryptography';,unity3d,unityscript,Unity3d,Unityscript,我必须用一个 Using System.Security; System.Security.Cryptography.Xml.SignedXml signedXml = new System.Security.Cryptography.Xml.SignedXml(lic); First Unity/VS抱怨说 VS>错误11中不存在类型或命名空间名称Xml' 名称空间System.Security.Cryptography'。你是不是错过了一场比赛 汇编参考 所以我在VisualStudio中

我必须用一个

Using System.Security;
System.Security.Cryptography.Xml.SignedXml signedXml = new System.Security.Cryptography.Xml.SignedXml(lic);
First Unity/VS抱怨说

VS>错误11中不存在类型或命名空间名称
Xml'
名称空间
System.Security.Cryptography'。你是不是错过了一场比赛 汇编参考

所以我在VisualStudio中添加了对System.Security的引用(C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Security.dll)…但Unity一直在抱怨这一点

错误CS0234:中不存在类型或命名空间名称
Xml'
命名空间
System.Security.Cryptography'。你错过一个集会了吗 推荐人

然后我试图直接复制资产文件夹中的'System.Security.dll',但仍然是相同的消息

请问我做错了什么?必须做什么?
非常感谢

unity的默认
.Net 2.0子集
API中排除了大部分
System.Security.Cryptography
命名空间。很可能
.Xml
也被剥离了。因此,请执行以下操作之一:

  • 在Unity中,单击Ctrl/Cmd+Shift+B打开构建菜单,单击
    播放器设置
    。在inspector中查找
    API兼容性级别
    ,默认设置为
    .Net 2.0子集
    。将其更改为
    .NET2.0
    ,其中包括先前剥离的其余类/名称空间
  • 如果错误仍然存在,请确保复制到Unity中的.dll来自.net 2.0 framework。Unity无法导入针对高于.net 2.0的framework的库
  • 这是unity的
    子集
    API中排除的内容:

    很抱歉,我找不到此文档的当前版本

    编辑:

    正如@user2737085所建议的,您还必须将
    mcs.rsp
    文件添加到您的
    Assets
    文件夹中
    mcs.rsp
    应为包含以下行的文本文件:

    -r:System.Security.dll
    

    妮卡,非常感谢你的帮助!我已经按照你的建议做了,而且很有效。。。但是我必须在项目资产文件夹中添加一个包含'-r:System.Security.dll'的'mcs.rsp'文件!再次感谢@user2737085酷,我已经编辑了未来迷失灵魂的答案