Friday 7 January 2011

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

This error occurs when your project doesn't have a strong name, and you try to deploy it to the Global Assembly Cache (GAC).


Here's how it's done

Double click properties in the solution explorer for the project you want to give a strong name.
Choose the "Signing" tab.


Check the checkbox "Sign the assembly"
In the drop down box choose "<new>".

A box for creating the key file will now pop up.
Give your key a name - feel free to be creative here. I'm not, so I'll just call it "key"
Choose not to use password protection.
Click ok.



That was it! :-D

Tip
Visual Studio now created a file called "key.snk" and placed it in the root of your projects folder.
If you later have to sign other projects in the same solution (or other solutions for that matter), you can reuse this key-file you just created.
Instead of selecting "<new>" in the drop down box, select "<browse>" and browse your way to your existing key-file.


.

No comments:

Post a Comment