Loading ...

Create strong named assembly without compiling | CodeAsp.Net

Create strong named assembly without compiling

4.82 
 /5
4.82 (1votes)

In a recent project, we had to create strong named version of two assemblies (A and B, where A refers B) without recompiling. Using the method mentioned here:

http://blogs.msdn.com/b/miah/archive/2008/02/28/how-to-assign-a-strong-name-to-an-unsigned-3rd-party-assembly.aspx

we were able to create the strong named versions of both A and B. But when we added these assemblies in the client project, we got errors asking us to refer B again as that version did not contain the objects A expected. We realized these errors are coming because of the way A and B were strong named.

After some hacking, we found out that the problem was that we were strong naming the assemblies "separately", i.e. one-by-one. Since the original version of assembly A was already referencing assembly B, the strongly typed A assembly was unable to refer to the strongly typed B assembly in the project as they were created spearately. Why? I dont know exactly but I am guessing that the logic of strong naming related assemblies uses some factor which creates a different version if the assemblies are referring each other. 

So looked for a tool by which we could strong name both the assemblies together. I found this:

http://signer.codeplex.com/

I followed the instructions, copied the signer.exe in the project directory, opened the Visual Studio Command Prompt and changed the directory to the project directory. Then strong named both A and B DLLs together using this syntax:

 

signer -k key.snk -outdir . -a A.dll B.dll

This created the strong named versions of these assemblies in the same directory. When we added these to the project, it worked. 

Comments (2)

   
hajan
Nice solution.
7/11/2011
 · 
by
   
Shaitender
Nice post sir !! Really Helpful !!!
7/12/2011
 · 
by

Top Posts