Saturday, June 28, 2008

Howto: Strong naming a prebuilt assembly

If you need to apply a strong name to an assembly that was provided, already compiled, to you and you don't have the source, What you will do?

You first will need to produce the Microsoft intermediate language (MSIL) for the assembly using the ILDASM.EXE utility, then use an assembly key file to sign that MSIL into a new DLL using the ILASM.EXE utility.
Obtain the MSIL for the provided assembly From a VS.NET command prompt, enter the following: c:\>ildasm providedAssembly.dll /out:providedAssembly.il
Rename/Backup the original assembly or save it with a .bak extension. Once this is done.
Create a new assembly from the MSIL output and your assembly keyfile Assuming you already have an assembly key pair file ,do the following from a VS.NET command prompt:

c:\>ilasm providedAssembly.il /dll /key=keypair001.snk

Alas, you have an assembly strong named.
(Source:
http://www.andrewconnell.com/blog/archive/2004/12/15/772.aspx)

No comments: