我可以告诉bindingRedirect始终使用最新的可用版本吗?

Uwe*_*eim 19 .net c# asp.net asp.net-mvc assembly-binding-redirect

拥有一个ASP.NET应用程序,Web.Config文件中有以下格式的几个条目:

<dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-1.6.5135" newVersion="1.6.5135" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

这些库以NuGet包的形式出现.

现在,每当我更新我的20多个NuGet包时,我会做类似的事情:

  1. 单击一下即可更新所有包.
  2. 在浏览器中打开应用程序.
  3. 看到像这样的错误.
  4. 打开我的Web.Config,找到绑定重定向条目.
  5. 查找程序集最新版本.
  6. 修改我的web.config.
  7. 更新具有绑定重定向的所有其他更新的NuGet包的步骤2 ... 6.

非常烦人.

我的问题:

有没有办法告诉bindingRedirect条目总是使用最新版本?

例如:

<bindingRedirect oldVersion="0.0.0.0-*" newVersion="*" />
Run Code Online (Sandbox Code Playgroud)

(使用通配符告诉最新版本)

我最接近的是:

<bindingRedirect oldVersion="0.0.0.0-9.9.9.9" newVersion="1.6.5135" />
Run Code Online (Sandbox Code Playgroud)

(仅指定最新版本一次)

Bri*_*128 9

不幸的是,答案是否定的.请参阅MSDN上bindingRedirect元素.

报价:

oldVersion:必需属性.

指定最初请求的程序集的版本.程序集版本号的格式为major.minor.build.revision.此版本号的每个部分的有效值为0到65535.

您还可以使用以下格式指定一系列版本: nnnn - nnnn

newVersion:必需属性.指定要使用的程序集的版本,而不是最初请求的版本,格式为:nnnn

此值可以指定早于oldVersion的版本.