<dependentAssembly > 元素<dependentAssembly> Element

封装每个程序集的绑定策略和程序集位置。Encapsulates binding policy and assembly location for each assembly. 使用一个dependentAssembly每个程序集的元素。Use one dependentAssembly element for each assembly.

<configuration><configuration>
<运行时 ><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