Wednesday, October 15, 2014

This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache

Sometimes, when I try to deploy my SharePoint solutions created in Visual Studio, I get this error message:


Error occurred in deployment step 'Add Solution': This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache.



This error appears because assembly isn't signed. What does it mean? Assembly signing is giving an application a unique identity so that other software can use to identify and refer explicitly to it (definition by Microsoft).
More on assembly signing on this link:
http://msdn.microsoft.com/en-us/library/ms247123%28v=vs.90%29.aspx

Here are the steps how to strong-sign assembly in Visual Studio 2012 (also mentioned in the link above):
 

1. Right mouse click on your project's name (in Solution Explorer) and click on "Properties". In the Project Designer, click the Signing tab.





2. Select the Sign the assembly check box.




3. In the "Choose a strong name key file" drop-down list, select <New...>. The Create Strong Name Key Dialog Box appears in which you need to give it a name (usually it is "key.snk"). You can choose to use password if you want, but it isn't necessary and then click OK.




Now, assembly is signed, and the error appears no more when trying to deploy solution.

2 comments: