<publisherPolicy > 項目<publisherPolicy> Element

指定執行階段是否套用發行者原則。Specifies whether the runtime applies publisher policy.

<configuration><configuration>
<執行階段 ><runtime>
<assemblyBinding><assemblyBinding>
<dependentAssembly><dependentAssembly>
<publisherPolicy><publisherPolicy>

語法Syntax

<publisherPolicy apply="yes|no"/>  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

屬性Attribute 描述Description
apply 指定是否要將發行者原則套用。Specifies whether to apply publisher policy.

套用屬性apply Attribute

Value 描述Description
yes 發行者原則套用。Applies publisher policy. 這是預設設定。This is the default setting.
no 不適用於發行者原則。Does not apply publisher policy.

子元素Child Elements

無。None.

父項目Parent Elements

項目Element 描述Description
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有關組件繫結和記憶體回收的資訊。Contains information about assembly binding and garbage collection.

備註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. 若要指定是否為特定組件套用發行者原則,請將放 <publisherPolicy > 中的項目 <dependentAssembly > 項目。To specify whether to apply publisher policy for a particular assembly, put the <publisherPolicy> element in the <dependentAssembly> element.

預設值套用屬性是The default setting for the apply attribute is yes. 設定套用屬性設定為沒有覆寫任何先前組件的設定。Setting the apply attribute to no overrides any previous yes settings for an assembly.

需要明確地略過發行者原則使用的應用程式的權限 <apply ="no"/ >應用程式組態檔中的項目。Permission is required for an application to explicitly ignore publisher policy using the <publisherPolicy apply="no"/> element in the application configuration file. 藉由設定授與權限SecurityPermissionFlag加上旗標上SecurityPermissionThe permission is granted by setting the SecurityPermissionFlag flag on the SecurityPermission. 如需詳細資訊,請參閱 < 組件繫結重新導向安全性使用權限For more information, see Assembly Binding Redirection Security Permission.

範例Example

下列範例會關閉發行者原則組件, myAssemblyThe 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>  

另請參閱See also