Tuesday, June 14, 2011

Signing an Assembly(DLL) without recompilation

While i was working on migration of one of our old application, i came across one situation where, i need to deploy a DLL into GAC. So what, what is the problem? Yes there is a problem, my old assembly is not strong named or signed. Thats it. As we know, we can't deploy non signed assemblies in to GAC.

That assembly was developed using .net framework 1.1 and i have no access to the development machine now. What to do now? Then, I have started exploring different options. I found one blog, where he has given few commands for strong naming assembly without recompilation. That's awesome. I gave a try with a sample DLL. Simply superb!!!!! Only 3 Steps, It worked perfectly.

Here is the Commands,

Go to your Visual Studio command Prompt, then navigate to the folder where you have the DLL to be signed. then type the following commands.

> ildasm MyAssembly.dll /out:MyAssembly.il
> sn -k MyKeyFile.snk
> ilasm MyAssembly.il /dll /key=MyKeyFile.snk

That's it, the DLL is strong named or signed. Now give a test by dropping the dll in to GAC.

No comments:

Post a Comment