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>