適用於 <執行階段> 的 <assemblyIdentity> 元素

包含組件的識別資訊。

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

Syntax

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

屬性和項目

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

屬性

屬性 描述
name 必要屬性。

組件名稱
culture 選擇性屬性。

指定組件語言及國家/地區的字串。
publicKeyToken 選擇性屬性。

指定組件強式名稱的十六進位值。
processorArchitecture 選擇性屬性。

值為「x86」、「amd64」、「msil」或「ia64」其中之一,指定包含處理器特定程式碼的組件的處理器架構。 值不區分大小寫。 如果屬性被指派任何其他值,則會忽略整個 <assemblyIdentity> 元素。 請參閱 ProcessorArchitecture

processorArchitecture 屬性

描述
amd64 僅限 AMD x86-64 架構。
ia64 僅限 Intel Itanium 架構。
msil 相對於處理器和每個字組的位元而言是中性的。
x86 32 位 x86 處理器 (原生或位於 64 位元平台的 Windows on Windows (WOW) 環境)。

子元素

無。

父項目

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

備註

每個 <dependentAssembly> 元素都必須有一個 <assemblyIdentity> 子項目。

processorArchitecture 屬性如果存在,則 <assemblyIdentity> 元素僅套用至具有對應處理器架構的組件。 如果 processorArchitecture 屬性不存在,則 <assemblyIdentity> 元素可套用至具有任何處理器架構的組件。

下列範例顯示兩個具有相同名稱的組件組態檔,其目標為兩個不同的處理器架構,並且其版本尚未保持同步。當應用程式在 x86 平台執行時,會套用第一個 <assemblyIdentity> 元素,並忽略另一個元素。 如果應用程式在 x86 或 ia64 以外的平台執行,則兩者都會被忽略。

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

如果組態檔包含沒有 processorArchitecture 屬性的 <assemblyIdentity> 元素,並且不包含符合平台的元素,則使用沒有 processorArchitecture 屬性的元素。

範例

下列範例示範如何提供組件的相關資訊。

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

另請參閱