[英]The type or namespace name `Xml' does not exist in the namespace `System.Security.Cryptography'
I have to read a signed xml with a 我必须阅读带有
Using System.Security;
System.Security.Cryptography.Xml.SignedXml signedXml = new System.Security.Cryptography.Xml.SignedXml(lic);
First Unity/VS complained that First Unity / VS抱怨说
VS > Error 11 The type or namespace name
Xml' does not exist in the namespace
System.Security.Cryptography'.VS>错误11类型或名称空间名称
Xml' does not exist in the namespace
System.Security.Cryptography'Xml' does not exist in the namespace
。 Are you missing an assembly reference?您是否缺少装配参考?
So I added a reference to System.Security in Visual Studio (C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\System.Security.dll)...but Unity keeps complaining that 所以我在Visual Studio(C:\\ Windows \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ System.Security.dll)中添加了对System.Security的引用...但是Unity一直抱怨
error CS0234: The type or namespace name
Xml' does not exist in the namespace
System.Security.Cryptography'.错误CS0234:类型或名称空间名称
Xml' does not exist in the namespace
System.Security.Cryptography'Xml' does not exist in the namespace
。 Are you missing an assembly reference?您是否缺少装配参考?
I then tried to directly copy the 'System.Security.dll' inside the asset folder...but still the same message! 然后,我尝试直接在资产文件夹中复制“ System.Security.dll” ...但仍然是相同的消息!
What am I doing wrong please? 请问我做错了什么? What has to be done?
必须做什么? Thanks very much!
非常感谢!
Most of the System.Security.Cryptography
namespace is excluded from the unity's default .Net 2.0 Subset
API. 单位的默认
.Net 2.0 Subset
API排除了大多数System.Security.Cryptography
命名空间。 Most probably .Xml
is also stripped. .Xml
很可能也被剥离了。 So do one of the following: 因此,请执行以下任一操作:
player settings
. player settings
。 In inspector find API Compatability Level
which is set to .Net 2.0 Subset
by default. API Compatability Level
,默认情况下将其设置为.Net 2.0 Subset
。 Change it to .Net 2.0
which includes the rest of the previously stripped classes/namespaces. .Net 2.0
,其中包括以前剥离的其余类/命名空间。 This is what is excluded from the unity's Subset
API: https://docs.unity3d.com/412/Documentation/ScriptReference/MonoCompatibility.html 这是单位的
Subset
API排除的内容: https : //docs.unity3d.com/412/Documentation/ScriptReference/MonoCompatibility.html
Sorry, I couldn't find the current version of this document 抱歉,我找不到此文档的当前版本
EDIT: 编辑:
as @user2737085 suggested - you'd also have to add mcs.rsp
file to your Assets
folder. 按照@ user2737085的建议-您还必须将
mcs.rsp
文件添加到Assets
文件夹中。 mcs.rsp
should be a text file containing the following line: mcs.rsp
应该是包含以下行的文本文件:
-r:System.Security.dll
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.