c# - 当新版本不存在时使用 <bindingRedirect> 到新版本的程序集

标签 c# .net web-config assemblybinding

在某些客户端使用版本 11 而不是版本 10 的情况下,我使用 bindingRedirect 将 TFS 程序集从版本 10 重定向到版本 11。该应用程序是使用 TFS v10 DLL 编译的。

<dependentAssembly>
    <assemblyIdentity name="Microsoft.TeamFoundation.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-10.65535.65535.65535" newVersion="11.0.0.0" />
</dependentAssembly>

问题是,如果客户端使用的是 TFS 版本 11 而不是 TFS 版本 10,则重定向工作正常。如果客户端使用的是 TFS v10 而不是 TFS v11,则会出现运行时错误:

Could not load file or assembly, :microsoft.TeamFoundation.Common, Version=11.0.0.0, ... etc.

如果版本 11 不可用,应用程序是否应该回退使用 DLL 的 v10?

最佳答案

Shouldn't the application fallback to use v10 of the dll's if version 11 are not available???

不,因为您在配置文件中指定了绑定(bind)重定向。

关于c# - 当新版本不存在时使用 <bindingRedirect> 到新版本的程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11958045/

相关文章:

c# - Azure 函数从配置访问连接字符串

c# - 默认代理如何绕过大多数网址并仅适用于少数

c# - 目标框架未在 Visual Studio 2019 中显示

azure - 如何覆盖 Azure Web App 自定义部分中的 web.config 值?

typescript - 如何从 TypeScript 中的 web.config 获取 key ?

c# - Linq:获取丢失的记录

c# - 如果我有一个具有 setter/getter 的Property_1且该 setter/getter 从Property_2获取值,那么Property_1本身是否真正拥有一个值/引用?

c# - 在日历日打开文本框单击

c# - 通用运行时?

c# - 使用各种方法将访问者重定向到网站的不同区域?