C# .NET程序集依赖项版本回退
因此,我有一个GUI应用程序(C#.NET 4.0),我们将其称为main.exe。它依赖于类库,我们称之为library.dll(C#.NET 3.5),附带了几个版本(我们将说1.1.0.0、1.2.0.0和1.3.0.0)。将在目标环境的GAC中安装一个(或多个)版本的library.dll。所有涉及的程序集都具有强名称 我的目标是让main.exe使用library.dll的任何可用版本,如果可能的话,尝试使用最新版本。然而,我的工作受到一些限制:C# .NET程序集依赖项版本回退,c#,.net,dependencies,assemblies,C#,.net,Dependencies,Assemblies,因此,我有一个GUI应用程序(C#.NET 4.0),我们将其称为main.exe。它依赖于类库,我们称之为library.dll(C#.NET 3.5),附带了几个版本(我们将说1.1.0.0、1.2.0.0和1.3.0.0)。将在目标环境的GAC中安装一个(或多个)版本的library.dll。所有涉及的程序集都具有强名称 我的目标是让main.exe使用library.dll的任何可用版本,如果可能的话,尝试使用最新版本。然而,我的工作受到一些限制: library.dll是现有程序集,此
<?xml version ="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<!--
intent here is to provide a range of possible installed assemblies
but .NET does not allow ranges in newVersion
-->
<assemblyIdentity name="library" publicKeyToken="..." culture="neutral"/>
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.1.0.0-1.3.0.0"/>
</dependentAssembly>
<dependentAssembly>
<!--
intent here is to provide a fallback list of possible installed assemblies
but .NET ignore all but the first bindingRedirect
-->
<assemblyIdentity name="library" publicKeyToken="..." culture="neutral"/>
<bindingRedirect oldVersion="1.3.0.0" newVersion="1.1.0.0"/>
<bindingRedirect oldVersion="1.2.0.0" newVersion="1.1.0.0"/>
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.1.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>