I've added a weakly named assembly to my Visual Studio 2005 project (which is strongly named). I'm now getting the error:
"Referenced assembly 'xxxxxxxx' does not have a strong name"
Do I need to sign this third-party assembly?
assembliescstrongnamevisual studiovisual-studio-2005
I've added a weakly named assembly to my Visual Studio 2005 project (which is strongly named). I'm now getting the error:
"Referenced assembly 'xxxxxxxx' does not have a strong name"
Do I need to sign this third-party assembly?
Best Answer
To avoid this error you could either:
You will find instructions on signing third-party assemblies in .NET-fu: Signing an Unsigned Assembly (Without Delay Signing).
Signing Third-Party Assemblies
The basic principle to sign a thirp-party is to
Disassemble the assembly using
ildasm.exe
and save the intermediate language (IL):Rebuild and sign the assembly:
Fixing Additional References
The above steps work fine unless your third-party assembly (A.dll) references another library (B.dll) which also has to be signed. You can disassemble, rebuild and sign both A.dll and B.dll using the commands above, but at runtime, loading of B.dll will fail because A.dll was originally built with a reference to the unsigned version of B.dll.
The fix to this issue is to patch the IL file generated in step 1 above. You will need to add the public key token of B.dll to the reference. You get this token by calling
which will give you the following output:
The last line contains the public key token. You then have to search the IL of A.dll for the reference to B.dll and add the token as follows: