Technical/Business Aspects in IT

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

Posted by scmay on July 17, 2008

Generate a snk key

Link here : http://forums.asp.net/t/1060132.aspx

First, you need to create a Public/Private Key Pair.
Choose >Start, >Programs, >Microsoft Visual Studio 2005, >Visual Studio Tools, >Visual Studio 2005 Command Prompt.
Enter the following at the command prompt and then press Enter…
sn -k C:\Temp\sgKey.snk
Now the key pair is created.

Basically, you have to disassemble and reassemble

Found this here http://forums.msdn.microsoft.com/en-US/clr/thread/35930958-9775-4e56-bd38-0362d124ffc4/

Solution of the assigning the strong name to the third part DLL by using following command on visual studio command prompt.

E.g. Lets say the name of the third party DLL is myTest.dll.
Step 1: Dis-assemble the assembly
ildasm myTest.dll /out:myTest.il

Step 2: Re-Assemble using your strong-name key
ilasm myTest.il /res:myTest.res /dll /key:myTest.snk /out:myTestSN.dll

This code work perfectly to assign strong name.

for verification you can use following command,
sn -vf myTestSN.dll

From
Nimit Patel
nimit_104@yahoo.com

8 Responses to “Assembly generation failed — Referenced assembly does not have a strong name”

  1. Naresh Gupta said

    This is not working for me, while using Ilasm I am getting failure messages and in the end ** FAILURE **, what I am doing wrong?

  2. scmay said

    What kind of failure messages?

  3. After reading through the article, I feel that I really need more information on the topic. Can you share some resources please?

  4. scmay said

    I am not exactly sure what information are you looking for. Do you want resources on snk, or other types of solution to the topic error that you are getting, or generating public/private snk keys?

  5. Bhagwan Bharose said

    @Naresh,
    It may be due to your dll is read only.
    Remove it and try….

  6. Kerem said

    It works! Thanks,

    For the failure message like the Naresh saw, you just have to give the full path of the key file Previously generated to the assemble command.

  7. Sa Mo Hung said

    yes it works. thanks!

  8. Abhishek Patel said

    Thanks, It works for me … 🙂

    -Abhishek Patel

Leave a comment