<dependentAssembly> 元素

封裝每一個組件的繫結原則和組件位置。 每個組件使用一個 dependentAssembly 元素。

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

Syntax

<dependentAssembly>
</dependentAssembly>  

屬性和項目

下列章節說明屬性、子元素和父元素。

屬性

無。

子元素

元素 描述
assemblyIdentity 包含組件的相關識別資訊。 每個 dependentAssembly 元素都必須包含這個元素。
codeBase 指定如果電腦上未安裝共用組件,執行階段可以在何處找到共用組件。
bindingRedirect 將一個組件版本重新導向至另一個版本。
publisherPolicy 指定執行階段是否套用此組件的發行者原則。

父項目

元素 描述
assemblyBinding 包含有關組件版本重新導向和組件位置的資訊。
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。
runtime 包含有關組件繫結和記憶體回收的資訊。

範例

下列範例示範如何封裝兩個組件的組件資訊。

<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>  

另請參閱