How to create Strong named assemblies in .NET

This post is a very simple example of how to create strong named assemblies and use in a solution. Each project uses the same strong named key. One key is uesd for the whole solution.

Step 1:
Create the snk Key

Open the Developer Command prompt as an administrator and enter sn -k C:/yourKeyPairName.snk

Step 2:
Add your key to the solution base directory and link it in each project


Note: Add As Link and not Add!, Add copies the key.

Step 3:
Use the snk in the project

Open the properties of each project, and in the signing tab, sign the project with your key.

Now all projects are strong named. The same key is used for all projects. The assemblies can be use in the GAC or are harder to tamper with.

You can also sign assemblies, if you don’t have the source code using the Ildasm.exe tool. You should only do this if you don’t have the source code. You should not use this approach if you have the source code as this borders on a dirty hack…

If you need to sign 3rd Party assemblies in you project, maybe the 3rd party assemblies shouldn’t be used…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: