tutorial

Written by

in

The Brutal Developer .NET Assembly Strong-Name Signer is an open-source utility designed to automatically strong-name sign .NET assemblies. It is widely used by developers who need to sign compiled .dll or .exe files, especially when they do not have access to the original source code. The Core Problem It Solves

In .NET development, if your project is strong-name signed, all assemblies referenced by your project must also be strong-name signed. If you attempt to reference an unsigned, third-party library, the .NET compiler throws a disruptive error:“Referenced assembly ‘A.B.C’ does not have a strong name”.

If the third-party maintainer has abandoned the library or refuses to sign it, you are stuck. The Strong-Name Signer fixes this by injecting a strong-name key directly into the compiled binary. Key Features

Dependency Fixing: It rewrites the target assembly’s references (and InternalsVisibleTo attributes) so that everything links correctly to the newly signed versions.

Key Generation: It can use your existing .snk key file or automatically generate a temporary one for you if you do not have one.

No SDK Dependancy: Unlike Microsoft’s official tools (sn.exe, ildasm.exe, ilasm.exe), it does not require you to have the Windows SDK or specific Visual Studio command prompts installed.

Safety Net: It automatically backs up the original files before making any structural changes.

BAML Updates: It updates binary XAML (BAML) resources within WPF applications to ensure internal references match the new signature. How to Use It

The utility is highly flexible and can be used in three distinct ways: 1. Via the Graphical User Interface (GUI)

You can download the standalone Windows application, drag-and-drop your unsigned .dll files into the window, select your key file, and click sign. 2. Via the Command-Line Interface (CLI) Excellent for build automation or post-build event scripts.

StrongNameSigner.Console.exe -a “C:\Path\To\UnsignedAssembly.dll” -k “C:\Path\To\Key.snk” Use code with caution.

(If -k is omitted, the tool automatically generates a new key pair for you). 3. Via NuGet Package (Automated Build Integration)

You can add the Brutal.Dev.StrongNameSigner package directly to your .NET project. Once installed, it hooks into your MSBuild pipeline.

It will automatically sign every unsigned reference in your project during compilation without requiring any manual intervention.

If you are setting up a CI/CD pipeline or fixing an old project, I can help you write a post-build script or show you how to configure the NuGet package to do this seamlessly. Let me know what framework version you are targeting! NET Assembly Strong-Name Signer – GitHub

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *