包含關於組合語言版本重定向及組裝檔位置的資訊。
語法
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
</assemblyBinding>
屬性和項目
下列章節說明屬性、子元素和父元素。
Attributes
| Attribute | Description |
|---|---|
| XMLSNS | 必要屬性。 指定組合語言綁定所需的 XML 命名空間。 使用字串「urn:schemas-microsoft-com:asm.v1」作為值。 |
| 應用於 | 指定 .NET Framework 組合轉換所適用的執行版本。 此選用屬性使用.NET Framework版本號來表示其適用的版本。 若未 appliesTo 指定屬性,該 <assemblyBinding> 元素將套用至所有版本的 .NET 框架。 此 appliesTo 屬性於 .NET Framework 1.1 版本引入;.NET Framework 1.0 版本則忽略此屬性。 這表示在使用 .NET Framework 1.0 版本時,所有 <assemblyBinding> 元素都會被套用,即使 appliesTo 有指定屬性。 |
子元素
| 元素 | Description |
|---|---|
| <dependentAssembly> | 封裝了具有約束力的政策及集會地點。 每個組件用一個 <dependentAssembly> 標籤。 |
| <探測> | 指定子目錄,並於載入組譯時的共通語言執行時搜尋。 |
| <出版方政策> | 指定執行時是否套用發佈者政策。 |
| <資格賽 議會> | 指定在使用部分名稱時應動態載入的組件全名。 |
父項目
| 元素 | Description |
|---|---|
configuration |
通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。 |
runtime |
包含關於組裝裝訂與垃圾回收的資訊。 |
Example
以下範例說明如何將一個組合語言版本重新導向到另一個組合語言版本並提供程式碼庫。
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
<codeBase version="2.0.0.0"
href="http://www.litwareinc.com/myAssembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
以下範例說明如何利用屬性 appliesTo 來重新導向 .NET Framework 組合的綁定。
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="mscorcfg" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>