在 .NET 中的大多数应用程序都不需要强名字 [1]。强名字也会带来麻烦,因为它们最终需要在运行时进行验证。
Most applications in .NET do not need to be strong named. Strong names can also introduce pain because they end up requiring binding redirects. Because of this, many OSS libraries do not strong name their assemblies.
Strong named assemblies that reference assemblies that aren't strong named are rejected by the .NET Framework (desktop app only restriction). So if for whatever reason you actually do need to strong name your project, you couldn't easily consume open source packages.
Strong Namer is a NuGet package which aims to change this. Simply install the StrongNamer NuGet package, and it will transparently and automatically sign the assemblies you reference as part of the build process.
Here's how to try Strong Namer out for yourself:
…Start without debugging (CTRL+F5)
:disappointed:
Add a reference to the StrongNamer NuGet package
Start without debugging (CTRL+F5)
:sparkles: :fireworks: :smile: :fireworks: :sparkles:
The NuGet package includes an MSBuild targets file and task which hook into the build process and add a strong name to any references which aren't strong named just before they are passed to the compiler.
The task uses Mono.Cecil to do this. Credit goes to Nivot.StrongNaming for showing me how to do this.
You can conditionally disable automated signing of unsigned packages by setting the "DisableStrongNamer" property to "true". This is particularly useful if you have a custom build configuration for your application (e.g., you only wish for unsigned packages to be autosigned in specific environments).
暂无开放 Issues,或尚未同步最近议题。