Let your. NET program compatible with different versions of DLL files

Source: Internet
Author: User
Tags versions
A WinForm. NET program written a few days before the program. Because there are a lot of references to library files, these libraries have recently been fixed with bugs and algorithms. But the main program file is not changed. So it's not like recompiling the main program. So you copy all the new version of the DLL file to the running directory, you want the main program to directly call the new version of the library file. It turns out that all of these library files were signed with strong name. The main program was called with an error, saying that the version of the file could not be found.

Then I checked MSDN and found that I could just add the runtime node to CONFIG.

<runtime>
<assemblybinding xmlns= "Urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<assemblyidentity name= "MyAssembly"
Publickeytoken= "2b7c3a3291de04"
Culture= "neutral"/>
<bindingredirect oldversion= "3.0.0.8"
newversion= "4.1.0.0"/>

</dependentAssembly>
</assemblyBinding>
</runtime>

However, there is a prerequisite that the two DLL PublicKeyToken is the same, you need to use the same SN file to sign the line.

Of course, if your library file is not signed with strong name at all, you don't have to consider the version issue.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.