There are times when you need to sign a DLL with a strong name that you don’t have the source code to. For example third party DLLs that needs to be registered to the GAC to be used with COM / COM+ objects.
This is how it is done…
- Generate a KeyFile
-k keyFile.snk - Get the MSIL for the assembly
ildasm YourDLLNameHere.dll /out:YourDLLNameHere.il - I like to to this just as a safety – Rename the original DLL
ren YourDLLNameHere.dll YourDLLNameHere.dll.orig - Build a new assembly from the MSIL output and your KeyFile
ilasm YourDLLNameHere.il /dll /key= keyFile.snk
If you’ve not got your framework and sdk paths properly mapped… In framework 2 this is where the command line utilities are installed:
- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ilasm.exe
- C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ildasm.exe
- C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe

