We all use third-party libraries during development so we don't need to implement everything. Now sometimes you don't have source code for a library, only the assembly file that you use in your project. What if you have a strongly named project assembly but the third-party library is not signed (which means it doesn't have strong names)? Then you'll be in trouble. Recently I've been through this problem and learned the solution using ildasm and ilasm in two steps. Step 1: Launch the Visual Studio command prompt and run the following command for some third-party library, let's say Test.dll:c:\> ILdasm /all /out:Test.IL Test.dllStep 2: c:\> ilasm /dll /key:YourKey.snk Test.ILAnd you're done. But again there can be a trouble. Case: Let's say you have .Net 4.0 installed on your system. Your project is in let's say a .Net 3.5 version and the library that you're using is of version 2.0. Now when you do the signing with the previously described steps you'll end up in a version change of third-party library to 4.0. See How to check the version of your assembly? Now to eliminate this problem you need to ensure that is done when you bundle/package the Test.IL i.e. IL of your third-party generated in step I. Use the ilasm.exe utility of version 2.0 to do this; just explicitly specify the 2.0 ilasm.exe like this:c:\> c:\Windows\Microsoft.NET\Framework\v2.0.50727\ilasm.exe /dll /key:YourKey.snk Test.IL Now check the generated Test.dll again; it should be v2.0. Problem solved.. :) Cheers!!!
I'm a blogger, contributor, speaker more or less a community guy. If you have any topics that you want to have it available as blog/video/answer let me know, write me a message on c-sharpcorner or email me amit_85i[AT]ho... Read more
C# Corner. All contents are copyright of their authors.