<dependentAssembly > 元素<dependentAssembly> Element

封裝每一個組件的繫結原則和組件位置。Encapsulates binding policy and assembly location for each assembly. 針對每個元件使用一個 dependentAssembly 元素。Use one dependentAssembly element for each assembly.

<configuration> <configuration>
    <runtime >   <runtime>
        <assemblyBinding >     <assemblyBinding>
       <dependentAssembly >      <dependentAssembly>

語法Syntax

<dependentAssembly>   
</dependentAssembly>  

屬性和項目Attributes and Elements

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

屬性Attributes

無。None.

子項目Child Elements

項目Element 描述Description
assemblyIdentity 包含元件的識別資訊。Contains identifying information about the assembly. 此元素必須包含在每個 dependentAssembly 元素中。This element must be included in each dependentAssembly element.
codeBase 指定如果電腦上未安裝共用元件,執行時間可以在何處找到。Specifies where the runtime can find a shared assembly if it is not installed on the computer.
bindingRedirect 將一個組件版本重新導向至另一個版本。Redirects one assembly version to another.
publisherPolicy 指定執行時間是否套用此元件的發行者原則。Specifies whether the runtime applies publisher policy for this assembly.

父項目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.
runtime 包含有關組件繫結和記憶體回收的資訊。Contains information about assembly binding and garbage collection.

範例Example

下列範例顯示如何封裝兩個元件的元件資訊。The following example shows how to encapsulate assembly information for two assemblies.

<configuration>  
   <runtime>  
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
         <dependentAssembly>  
            <assemblyIdentity name="myAssembly"  
                              publicKeyToken="32ab4ba45e0a69a1"  
                              culture="neutral" />  
            <!--Redirection and codeBase policy for myAssembly.-->  
         </dependentAssembly>  
         <dependentAssembly>  
            <assemblyIdentity name="mySecondAssembly"  
                              publicKeyToken="32ab4ba45e0a69a1"  
                              culture="neutral" />  
            <!--Redirection and codeBase policy for mySecondAssembly.-->  
         </dependentAssembly>  
      </assemblyBinding>  
   </runtime>  
</configuration>  

請參閱See also