【问题标题】:Assembly could not be converted to type library - Error:Type library exporter cannot load type程序集无法转换为类型库 - 错误:类型库导出器无法加载类型
【发布时间】:2017-11-01 18:09:38
【问题描述】:

我正在尝试构建使用 .NET Framework 2.0

的旧组件之一

如果我使用 .Net Framework 4.0 构建相同的组件,它会成功构建,但是;

使用 .Net framework 2.0 时,构建失败并出现错误“无法将程序集转换为类型库。”

以下是此错误的完整错误报告:

Error   14  The assembly "X:\MyAssembly.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'Namespace.ComponentName, ProjectName'. Error: Type library exporter cannot load type 'Namespace.ComponentName' (error: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
   at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
   at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
   at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>

The demand was for:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>
</PermissionSet>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Perm

我想在 .Net framework 2.0 上构建这个程序集

我应该怎么做才能摆脱这个错误。请指出我正确的方向...

【问题讨论】:

  • X: 驱动器肯定是问题所在,映射的网络驱动器默认位于 IntraNet 区域中。你必须告诉you fully trust it

标签: c# .net visual-studio


【解决方案1】:

正如用户 Hans Passant 所指出的,X: 驱动器确实是问题所在。 通过给予“完全信任”,我无法使用 CASPOL 命令使其工作。 但是,当我使用 SUBST 命令映射 X: 驱动器时,我能够构建。

所以,Mapping X: drive by using SUBST 命令解决了我的问题。

subst X: D:\XDriveFolderToBeMapped

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-04
    • 2011-03-04
    • 1970-01-01
    • 2013-03-15
    • 2016-01-02
    • 1970-01-01
    相关资源
    最近更新 更多