We all use third party libraries while doing development because we don’t need to implement everything. Now sometime you don’t have source code for a library only the assembly file that you use in your project.
What if you have strongly named your project assembly and third party library is not signed(which means don’t have strong names) you’ll be in trouble. Recently I’ve been through this problem and get to know the solution using ildasm and ilasm in two steps.
Step I:
Launch the visual studio command prompt and run below command for some third party library lets say Test.dll
Step II:
And 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 say .Net 3.5 version and library is of 2.0 version that you’re using. Now when your do the signing with above mentioned 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 get rid of this problem you need to take care when you bundling/packaging the Test.IL i.e. IL of your third party generated in step I.
Use ilasm.exe utility of version 2.0 to achieve this just explicitly specify the 2.0 ilasm.exe like this -
Now check the generated Test.dll again it should be v2.0
Problem solved.. :) Cheers!!!
What if you have strongly named your project assembly and third party library is not signed(which means don’t have strong names) you’ll be in trouble. Recently I’ve been through this problem and get to know the solution using ildasm and ilasm in two steps.
Step I:
Launch the visual studio command prompt and run below command for some third party library lets say Test.dll
c:\> ILdasm /all /out:Test.IL Test.dll
Step II:
c:\> ilasm /dll /key:YourKey.snk Test.IL
And 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 say .Net 3.5 version and library is of 2.0 version that you’re using. Now when your do the signing with above mentioned 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 get rid of this problem you need to take care when you bundling/packaging the Test.IL i.e. IL of your third party generated in step I.
Use ilasm.exe utility of version 2.0 to achieve 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!!!
No comments:
Post a Comment