Assembly generation failed - Referenced assembly does not have a strong name

February 01, 2014 by Anuraj

.Net ASP.Net Visual Studio Windows Forms

Recently while working a on project I faced an error like this.

Assembly generation failed - Referenced assembly does not have a strong name

The assembly without strong name was a third party dll, I don’t have the source code with me. If you have strong named your application, it is a requirement like you need to strong name all your referenced assemblies as well. This post is about strong naming an assembly without source code. Here is the steps you need to follow.

  • Disassemble the assembly - You need to disassemble assembly using ildasm command. It will generate an IL file from the assembly.
ildasm /all /out=Sample.il Sample.dll

In this Test.dll is the assembly you want to strong name.

  • Generate a stong name or new key to sign your project if you don’t have an existing key. You can do this using sn utility.
sn -k TestKey.snk
  • Now reassemble the assembly from IL with the key generated. You can do this using the following command.
ilasm /dll /key=TestKey.snk Sample.il

Now your assembly is strong named. Try recompiling your project and it wont throw any error.

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub