Assembly Version Control

Source: Internet
Author: User

Version composition: Major version number. Minor version number. Build number. revision number,

<Major version>. <minor version>. <build number>. <revision>,

[Assembly: assemblyversion ( " 2. 1 .* " )]

 

The version number is strongly named.ProgramThe Uniqueness control of a set can be displayed. The following describes the strong name assembly.

 

Assembly redirection:

1. application level: Set the redirection element in the configuration file app. config/Web. config.

Versionredirect
<? XML version = " 1.0 " Encoding = " UTF-8 "   ?>
< Configuration >
< Runtime >
< Assemblybinding xmlns = " URN: Schemas-Microsoft-com: ASM. V1 " >
< Probing privatepath = " Libs " />
< Dependentassembly >
< Assemblyidentity name = " Mathlibrary "
Publickeytoken = " 8210bdce54dab3c2 " />
< Bindingredirect oldversion = " 1.1.1.1 "  
Newversion = " 1.1.2.2 " />
</ Dependentassembly >
</ Assemblybinding >
</ Runtime >
</ Configuration >

 

2. Machine range level: in machine. config ($ {. Net install path} \ config \ machine. config ),

Locate the <runtime> element node and perform version redirection control.

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ mscorcfg. MSC. NET Framework Configuration Tool

3. publisher policy: Unlike the configuration file in 1 and 2, it is the assembly, and its principle is as follows:

APP/Web. config/machine. confg, and change the called

The new orientation of the Assembly. Its naming convention is: Policy. <major version>. <minor version>. <assemblyname>

For example, if the mathlibrary. dll assembly has two versions: 1.1.2.2 and 1.1.3.3,

1. Edit the publisherpolicy. xml policy file.

Publisherpolicy. xml
< Configuration >
< Runtime >
< Assemblybinding Xmlns = "Urn: Schemas-Microsoft-com: ASM. V1" >
< Dependentassembly >
< Assemblyidentity Name = "Mathlibrary"
Publickeytoken = "8210bdce54dab3c2" />
< Bindingredirect Oldversion = "1.1.2.2"  
Newversion = "1.1.3.3" />
</ Dependentassembly >
</ Assemblybinding >
</ Runtime >
</ Configuration >

 

2. Generate a policy assembly and run the Al command (c: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ al.exe)

Al/link: publisherpolicy. xml/out: yy.1.1.mathlibrary. dll/keyf: http://www.cnblogs.com/../myKey.snk/V: 1.0.0.0

 

3. Install A. dll & policy.1.1.mathlibrary. dll of version 1.1.3.3 to GAC.

All requests for 1.1.2.2 will be forwarded to mathlibrary of version 1.1.3.3.

 

Codebase:The validity of the location range specified by codebase, which is different from the general/strong-name Assembly. For details, see the private assembly detection section.

Here, the demo only uses the explicit usage. In the above publisher policy, you can modify the publisherpolicy. xml file to redirect

Publisherpolicy. xml
< Configuration >
< Runtime >
< Assemblybinding Xmlns = "Urn: Schemas-Microsoft-com: ASM. V1" >
< Dependentassembly >
< Assemblyidentity Name = "Mathlibrary"
Publickeytoken = "8210bdce54dab3c2" />
< Bindingredirect Oldversion = "1.1.2.2"  
Newversion = "1.1.3.3" />
< Codebase Version = "1.1.3.3"  
Href = "File: // D: \ project \ net \ Assembly \ simplemath \ bin \ debug \ mathlibrary. dll" />
</ Dependentassembly >
</ Assemblybinding >
</ Runtime >
</ Configuration >

 

Policy priority:

Application configuration file (App. confg/Web. config), publisher policy file, and machine configuration file (high-> LOW)

 

Disable the publisher policy:You can disable the publisher policy in the application configuration file (Note: In the application configuration file,

Because there is a priority relationship), you can configure the application scope level and a specific assembly range. As follows:

Application Scope level
<? XML version = "1.0" encoding = "UTF-8" ?>
< Configuration >
< Runtime >
< Assemblybinding Xmlns = "Urn: Schemas-Microsoft-com: ASM. V1" >
< Publisherpolicy Apply = "No" />
</ Assemblybinding >
</ Runtime >
</ Configuration >

 

Assembly level
<? XML version = "1.0" encoding = "UTF-8" ?>
< Configuration >
< Runtime >
< Assemblybinding Xmlns = "Urn: Schemas-Microsoft-com: ASM. V1" >
< Dependentassembly >
< Assemblyidentity Name = "Mathlibrary"
Publickeytoken = "8210bdce54dab3c2" />
< Publisherpolicy Apply = "No" />
</ Dependentassembly >
</ Assemblybinding >
</ Runtime >
</ Configuration >

 

 

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.