C# Disciples

my life in Avalon ….

Strong naming an assembly without having the actual source code

Today I had a blocking issue, I was in the process of Strong naming my assemblies yet I was referencing a third party assembly that was not strongly named. This cause a compilation error :S what to do????

A colleague David Field sent me 2 command line snippets that do just the thing…

Basically the idea is to use ILDASM.exe (which comes with .net SDK) to convert the dll to il and then use ILASM to make that IL badk into a dll and sign it. (please note you need an SNK file, you can create one easily with the sn.exe or just use one from the other assemblies you are signing)

the magic of ILDASM and ILASM >>

ildasm myassembly.dll /out:myassembly.il

where myassembly is the name of the DLL

and then we convert that IL back in a dll and sign it with ILASM

ilasm myassembly.il /dll /key=MyStringNameFile.snk

Hope you find this useful I sure did

Advertisement

August 25, 2010 - Posted by | WPF

4 Comments »

  1. That is handy!

    Comment by Gagan Rajpal | August 25, 2010 | Reply

  2. I think this is also possible with ILMerge and the /keyfile switch on it.

    greetings Daniel

    Comment by Daniel Hoelbling | August 26, 2010 | Reply

  3. Nice one there, never had to use SNames where I am, bit can see it being useful. Thanks for sharing Marlon

    Comment by sacha | September 1, 2010 | Reply

  4. Nice, thanks!

    Comment by Leonard Woody | September 17, 2010 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 730 other followers