Share via


<publisherPolicy> Element 

Specifies whether the runtime applies publisher policy.

<configuration>

   <runtime>

      <assemblyBinding>

         <publisherPolicy>

<configuration>

   <runtime>

      <assemblyBinding>

         <dependentAssembly>

            <publisherPolicy>

<publisherPolicy apply="yes|no"/>

Required Attributes

Attribute Description

Apply

Specifies whether to apply publisher policy. Use one of the following values:

Yes

Applies publisher policy. This is the default setting.

No

Does not apply publisher policy.

Remarks

When a component vendor releases a new version of an assembly, the vendor can include a publisher policy so applications that use the old version now use the new version.

You can specify whether to apply publisher policy in the application's configuration file for either a specific assembly or all assemblies the application uses:

  • To specify whether to apply publisher policy for a particular assembly, put the <publisherPolicy> element in the <dependentAssembly> element.

  • To specify whether to apply publisher policy for all assemblies the application uses, put the <publisherPolicy> element in the <assemblyBinding> element.

The default setting for the apply attribute is yes. Setting the apply attribute to no overrides any previous yes settings. For example, if you set apply to no at the application-wide level, any assembly-specific apply setting is ignored, even if it declares the value to be yes. Thus, whenever the <publisherPolicy> element appears in the configuration file, the no setting is the only useful state, as this setting changes the default.

Permission is required for an application to explicitly ignore publisher policy using the <publisherPolicy apply="no"/> element in the application configuration file. The permission is granted by setting the BindingRedirects flag on the SecurityPermission Class. For more information, see Assembly Binding Redirection Security Permission.

Examples

The following example turns off publisher policy for the assembly, myAssembly.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="myAssembly"
                                    publicKeyToken="32ab4ba45e0a69a1"
                                    culture="neutral" />
            <publisherPolicy apply="no"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

The following example turns off publisher policy for all assemblies an application uses.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <publisherPolicy apply="no"/>
      </assemblyBinding>
   </runtime>
</configuration>

Configuration File

This element can be used in the application configuration file.

See Also

Reference

Runtime Settings Schema

Concepts

How the Runtime Locates Assemblies
Redirecting Assembly Versions

Other Resources

Configuration File Schema for the .NET Framework