<运行时 > 的<assemblyIdentity > 元素<assemblyIdentity> Element for <runtime>

包含有关程序集的标识信息。Contains identifying information about the assembly.

<configuration><configuration>
<运行时 ><runtime>
<assemblyBinding><assemblyBinding>
<dependentAssembly><dependentAssembly>
<assemblyIdentity><assemblyIdentity>

语法Syntax

   <assemblyIdentity    
name="assembly name"  
publicKeyToken="public key token"  
culture="assembly culture"/>  

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
name 必需的特性。Required attribute.

程序集的名称The name of the assembly
culture 可选特性。Optional attribute.

一个字符串, 指定程序集的语言和国家/地区。A string that specifies the language and country/region of the assembly.
publicKeyToken 可选特性。Optional attribute.

一个十六进制值, 该值指定程序集的强名称。A hexadecimal value that specifies the strong name of the assembly.
processorArchitecture 可选特性。Optional attribute.

值 "x86"、"amd64"、"msil" 或 "ia64" 之一, 为包含特定于处理器的代码的程序集指定处理器体系结构。One of the values "x86", "amd64", "msil", or "ia64", specifying the processor architecture for an assembly that contains processor-specific code. 这些值不区分大小写。The values are not case-sensitive. 如果为该属性分配了其他任何值, 则<assemblyIdentity>将忽略整个元素。If the attribute is assigned any other value, the entire <assemblyIdentity> element is ignored. 请参阅 ProcessorArchitectureSee ProcessorArchitecture.

processorArchitecture 特性processorArchitecture Attribute

Value 描述Description
amd64 仅适用于 AMD x86-64 体系结构。AMD x86-64 architecture only.
ia64 仅限 Intel Itanium 体系结构。Intel Itanium architecture only.
msil 不特定于处理器和每字位数。Neutral with respect to processor and bits-per-word.
x86 32位 x86 处理器, 在64位平台上的 Windows on windows (WOW) 环境中。A 32-bit x86 processor, either native or in the Windows on Windows (WOW) environment on a 64-bit platform.

子元素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

每个 <dependentAssembly > 元素必须有一个 <assemblyIdentity > 子元素。Every <dependentAssembly> element must have one <assemblyIdentity> child element.

如果该processorArchitecture属性存在, 则<assemblyIdentity>元素仅适用于具有相应处理器体系结构的程序集。If the processorArchitecture attribute is present, the <assemblyIdentity> element applies only to the assembly with the corresponding processor architecture. 如果该processorArchitecture属性不存在, 则该<assemblyIdentity>元素可应用于具有任何处理器体系结构的程序集。If the processorArchitecture attribute is not present, the <assemblyIdentity> element can apply to an assembly with any processor architecture.

下面的示例显示了两个程序集的配置文件, 这些程序集具有两个不同的两个处理器体系结构, 并且其版本尚未保持同步。当应用程序在 x86 平台上执行时, <assemblyIdentity>第一个元素应用, 另一个元素将被忽略。The following example shows a configuration file for two assemblies with the same name that target two different two processor architectures, and whose versions have not been maintained in synch. When the application executes on the x86 platform the first <assemblyIdentity> element applies and the other is ignored. 如果应用程序在 x86 或 ia64 以外的平台上执行, 则会忽略这两者。If the application executes on a platform other than x86 or ia64, both are ignored.

<configuration>  
   <runtime>  
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
         <dependentAssembly>  
            <assemblyIdentity name="MyAssembly"  
                  publicKeyToken="14a739be0244c389"  
                  culture="neutral"  
                  processorArchitecture="x86" />  
            <bindingRedirect oldVersion= "1.0.0.0"   
                  newVersion="1.1.0.0" />  
         </dependentAssembly>  
         <dependentAssembly>  
            <assemblyIdentity name="MyAssembly"  
                  publicKeyToken="14a739be0244c389"  
                  culture="neutral"   
                  processorArchitecture="ia64" />  
            <bindingRedirect oldVersion="1.0.0.0"   
                  newVersion="2.0.0.0" />  
         </dependentAssembly>  
      </assemblyBinding>  
   </runtime>  
</configuration>  

如果配置文件包含<assemblyIdentity>没有processorArchitecture属性的元素, 并且不包含与平台相匹配的元素processorArchitecture , 则使用没有属性的元素。If a configuration file contains an <assemblyIdentity> element with no processorArchitecture attribute, and does not contain an element that matches the platform, the element without the processorArchitecture attribute is used.

示例Example

下面的示例演示如何提供有关程序集的信息。The following example shows how to provide information about an assembly.

<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>  
      </assemblyBinding>  
   </runtime>  
</configuration>  

请参阅See also