<dependentAssembly> 元素

封装每个程序集的绑定策略和程序集位置。 为每个程序集使用一个 dependentAssembly 元素。

<配置>
   <运行时>
     <assemblyBinding>
       <dependentAssembly>

Syntax

<dependentAssembly>
</dependentAssembly>

特性和元素

下列各节描述了特性、子元素和父元素。

特性

没有。

子元素

元素 Description
assemblyIdentity 包含有关程序集的标识信息。 此元素必须包含在每个 dependentAssembly 元素中。
codeBase 指定运行时在计算机上未安装共享程序集的位置。
bindingRedirect 将一个程序集版本重定向到另一个程序集版本。
publisherPolicy 指定运行时是否为此程序集应用发布者策略。

父元素

元素 Description
assemblyBinding 包含有关程序集版本重定向和程序集位置的信息。
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。
runtime 包含有关程序集绑定和垃圾回收的信息。

Example

以下示例演示如何封装两个程序集的程序集信息。

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

另请参阅