Strongly naming a 3rd party assembly - Could not load file or assembly

Adam picture Adam · Dec 19, 2012 · Viewed 11.1k times · Source

I am writing a Visual Studio 2012 extension, for internal use, which requires that all assemblies have a strong name. I am dependent on RestSharp (and a few other dlls), and since it is not strongly named, I am adding a strong name to it by following this. Everything works according to the output of the process, and even visual studio claims it is strongly named if I look at the properties of RestSharp.dll in the project references. However, when I go to use my extension I get a FileLoadException claiming:

Could not load file or assembly 'RestSharp, Version=104.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Any thoughts on how to resolve this or work around it?

Answer

x0n picture x0n · May 12, 2013

I wrote a NuGet solution level package to help with strong naming 3rd party assemblies with your own key.

This is targeted for signing the contents of NuGet packages that are using unsigned assemblies, in order to be able to link to these packages where the consuming project is strongly named. Access to the original source code is not required, and you may sign any assembly with your own strong naming key. You may also delay-sign if desired.

https://nuget.org/packages/Nivot.StrongNaming

You can read more about it on my blog:

http://www.nivot.org/blog/post/2013/04/30/Signing-unsigned-assemblies-in-NuGet-packages