Reference multiple versions of the same class library in the same item.

Source: Internet
Author: User
Tags name database

Reference multiple versions of the same class library in the same item.

How to reference multiple versions of the same class library in the same item?

In the same project, you may need to introduce multiple versions of A class library at the same time. For example, most of the functions are implemented based on version 1.0 of Class, now there is A special function available only in the 2.0 version of the Class Library. The best way is to rewrite it all based on the 2.0 version of the library.
However, the actual situation is that all functions are very stable and it is impossible to rewrite all the functions to add A small function. At this time, it is necessary to reference both versions of library A, 1.0 and 2.0.

Practice:
Assume that the file of database A is A. dll.
1. Name database A 1.0 file A1.dll
2. Name database A 2.0 file A2.dll
3. reference both A1.dll and A2.dll in the project
4. Add the following nodes to App. Config or Web. Config. Note that different versions direct to different files.

<Runtime> <assemblyBinding xmlns = "urn: schemas-microsoft-com: asm. v1 "> <dependentAssembly> <assemblyIdentity name =" A "publicKeyToken =" Export cec67a1cde3d4 "culture =" neutral "/> <codeBase version =" 1.0 "href =" A1.dll "/> </dependentAssembly> <assemblyIdentity name = "A" publicKeyToken = "Export cec67a1cde3d9" culture = "neutral"/> <codeBase version = "2.0" href = "A2.dll"/> </dependentAssembly> </assemblyBinding> </runtime>

 

Related Article

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.