简体   繁体   English

强名称程序集 - 必须更改数千个程序集

[英]strong name assembly - having to change thousands of assemblies

according to https://docs.microsoft.com/en-us/dotnet/framework/app-domains/create-and-use-strong-named-assemblies根据https://docs.microsoft.com/en-us/dotnet/framework/app-domains/create-and-use-strong-named-assemblies

A strong-named assembly can only use types from other strong-named assemblies.强名称程序集只能使用来自其他强名称程序集的类型。 Otherwise, the integrity of the strong-named assembly would be compromised.否则,强名称程序集的完整性将受到损害。

This is an issue because I would need to change all my thousands of assemblies, from weakly-named to strongly-named.这是一个问题,因为我需要更改我所有的数千个程序集,从弱命名到强命名。 This would take a long time, is there any way around this.这需要很长时间,有什么办法可以解决这个问题。

My use case:我的用例:

I am building an application which will allow users to write C#, and execute it.我正在构建一个允许用户编写 C# 并执行它的应用程序。 I am doing this through an application domain.我正在通过应用程序域执行此操作。 The application domain will compile the user code, in a partially trusted assembly.应用程序域将在部分受信任的程序集中编译用户代码。 The user will be able to call a utilities assembly library.用户将能够调用实用程序汇编库。 This utilities library, will be fully-trusted, and hence must be strongly named.这个实用程序库将被完全信任,因此必须被强命名。 This utilities library must be able to access the thousands of assemblies.该实用程序库必须能够访问数千个程序集。 The only way to do that now, is by changing all the assemblies to be strongly-named.现在唯一的方法是将所有程序集更改为强命名。 which means I would need to add a AssemblyKeyFile attribute to each one.这意味着我需要为每个属性添加一个 AssemblyKeyFile 属性。

Thanks Dan谢谢丹

Yes, you are right strongly typed assembly can not have weakly-named assemblies in the reference.是的,您是对的,强类型程序集不能在引用中包含弱命名程序集。

There is a cool nuget package which signs unsigned libraries in the references:有一个很酷的 nuget 包,它在引用中对未签名的库进行签名:

https://www.nuget.org/packages/strongnamer https://www.nuget.org/packages/strongnamer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM