<publisherPolicy> 元素

指定运行时是否应用发布者策略。

<配置>
   <运行时>
     <assemblyBinding>
       <dependentAssembly>
         <publisherPolicy>

Syntax

<publisherPolicy apply="yes|no"/>

特性和元素

下列各节描述了特性、子元素和父元素。

特性

Attribute Description
apply 指定是否应用发布者策略。

apply Attribute

价值 Description
yes 应用发布者策略。 这是默认设置。
no 不应用发布者策略。

子元素

没有。

父元素

元素 Description
assemblyBinding 包含有关程序集版本重定向和程序集位置的信息。
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。
dependentAssembly 封装每个程序集的绑定策略和程序集位置。 为每个程序集使用一个 <dependentAssembly> 元素。
runtime 包含有关程序集绑定和垃圾回收的信息。

注解

当组件供应商发布程序集的新版本时,供应商可以包含发布者策略,以便使用旧版本的应用程序现在使用新版本。 若要指定是否为特定程序集应用发布者策略,请将 <publisherPolicy> 元素放入元素中 <dependentAssembly>

属性的 apply 默认设置为 “是”。 设置属性 applyno 替代程序集的任何先前 yes 设置。

应用程序需要使用应用程序配置文件中的 <publisherPolicy apply=“no”/> 元素显式忽略发布服务器策略的权限。 通过 SecurityPermissionFlag 设置标记 SecurityPermission授予权限。 有关详细信息,请参阅 程序集绑定重定向安全权限

Example

以下示例关闭程序集 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>

另请参阅