<publisherPolicy > 元素<publisherPolicy> Element

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

<configuration> <configuration>
    <runtime >   <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 屬性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
assemblyBinding 包含有關組件版本重新導向和組件位置的資訊。Contains information about assembly version redirection and the locations of assemblies.
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.
dependentAssembly 封裝每一個組件的繫結原則和組件位置。Encapsulates binding policy and assembly location for each assembly. 針對每個元件使用一個 <dependentAssembly> 元素。Use one <dependentAssembly> element for each assembly.
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.

Apply屬性的預設設定為 [是]The default setting for the apply attribute is yes. 將 [套用屬性] 設定為 [] 會覆寫元件的任何先前的 [是] 設定。Setting the apply attribute to no overrides any previous yes settings for an assembly.

應用程式必須具備許可權,才能使用應用程式佈建檔中的<publisherPolicy apply = "no"/>元素明確忽略發行者原則。Permission is required for an application to explicitly ignore publisher policy using the <publisherPolicy apply="no"/> element in the application configuration file. 許可權是藉由在 SecurityPermission上設定 SecurityPermissionFlag 旗標來授與。The 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