2017-04-06 248 views
0

我要读一个签名的XML与类型或命名空间名称'的Xml“不存在命名空间'存在System.Security.Cryptography”

Using System.Security; 
System.Security.Cryptography.Xml.SignedXml signedXml = new System.Security.Cryptography.Xml.SignedXml(lic); 

首先团结/ VS抱怨

VS>错误11类型或命名空间名称Xml' does not exist in the namespace System.Security.Cryptography'。您是否缺少 程序集参考?

所以我在Visual Studio中加入System.Security的引用(C:\ WINDOWS \ Microsoft.NET \框架\ V2.0.50727 \ System.Security.dll)...但团结不断抱怨

错误CS0234:类型或名称空间名称Xml' does not exist in the namespace System.Security.Cryptography'。您是否缺少装配 参考?

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

我在做什么错误?必须做些什么? 非常感谢!

回答

1

大多数System.Security.Cryptography命名空间不包含在统一的默认.Net 2.0 Subset API中。最有可能的.Xml也被剥离。所以请执行以下操作之一:

  1. 在Unity中单击Ctrl/Cmd + Shift + B打开构建菜单,单击player settings。在检查员找到API Compatability Level默认设置为.Net 2.0 Subset。将其更改为.Net 2.0,其中包括先前剥离的类/名称空间的其余部分。
  2. 如果错误仍然存​​在,请确保您要复制到Unity的.dll来自.net 2.0框架。团结不能导入库目标框架.NET相比高2.0

这就是从团结的Subset API排除: https://docs.unity3d.com/412/Documentation/ScriptReference/MonoCompatibility.html

对不起,我找不到这个文件

的当前版本

编辑:

为@ user2737085建议 - 你也不得不mcs.rsp文件添加到您的Assets倍呃。 mcs.rsp应包含以下行的文本文件:

​​
+0

尼卡, 非常感谢您的帮助! 我按照你的建议做了,它的工作原理! ...但我不得不在项目资产文件夹中添加一个'mcs.rsp'文件,其中包含'-r:System.Security.dll'! 再次感谢! – Jayme

+0

@ user2737085很酷,我为未来的灵魂编辑了答案 –

相关问题