Vendors of assemblies can state that applications should use a newer version of an assembly by including a publisher policy file with the upgraded assembly. The publisher policy file specifies assembly redirection and code base settings, and uses the same format as an application configuration file. The publisher policy file is compiled into an assembly and placed in the global assembly cache.
There are three steps involved in creating a publisher policy:
- Create a publisher policy file.
- Create a publisher policy assembly.
- Add the publisher policy assembly to the global assembly cache.
Creating the Publisher Policy File
The schema for publisher policy is described in Redirecting Assembly Versions.
The following example shows a publisher policy file that redirects one version of myAssembly to another.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<!-- Redirecting to version 2.0.0.0 of the assembly. -->
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> To learn how to specify a code base, see Specifying an Assembly's Location.
Creating the Publisher Policy Assembly
Use the Assembly Linker (Al.exe) to create the publisher policy assembly.
To create a publisher policy assembly
- Type the following command at the command prompt:
al /link:publisherPolicyFile /out:publisherPolicyAssemblyFile /keyfile:keyPairFile
In this command:
The following command creates a publisher policy assembly called policy.1.0.myAssembly from a publisher policy file called pub.config, and assigns a strong name to the assembly using the key pair in the sgKey.snk file.
al /link:pub.config /out:policy.1.0.myAssembly.dll /keyfile:sgKey.snk
Adding the Publisher Policy Assembly to the Global Assembly Cache
Use the Global Assembly Cache tool (Gacutil.exe) to add the publisher policy assembly to the global assembly cache.
To add the publisher policy assembly to the global assembly cache
See Also
Programming With Assemblies | How the Runtime Locates Assemblies | Configuration Files | Configuring Applications | Runtime Settings Schema | Configuration File Schema