Having an ASP.NET application there are several entries in the Web.Config file in this format:
ASP。NET应用程序Web中有几个条目。配置文件格式:
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135" newVersion="1.6.5135" />
</dependentAssembly>
These libraries come as NuGet packages.
这些库是NuGet包。
Now every time I update my 20+ NuGet packages I do something like:
现在,每当我更新我的20多个NuGet包时,我都会做以下事情:
- One click to update all packages.
- 只需单击即可更新所有包。
- Open the application in browser.
- 在浏览器中打开应用程序。
- See errors like this one.
- 看到像这样的错误。
- Open my Web.Config, find the binding redirect entry.
- 打开我的网站。配置,查找绑定重定向条目。
- Lookup the assemblies latest version.
- 查找程序集最新版本。
- Modify my web.config.
- 修改web . config。
- Update those steps 2…6 for all other updated NuGet packages with binding redirects.
- 更新步骤2…6,所有其他更新的NuGet包都有绑定重定向。
This is very annoying.
这是很烦人的。
My question:
我的问题:
Is there a way to tell the bindingRedirect
entry to always use the latest version?
有没有一种方法可以告诉bindingRedirect条目总是使用最新的版本?
E.g. something like:
例如像:
<bindingRedirect oldVersion="0.0.0.0-*" newVersion="*" />
(Using a wildcard to tell the latest version)
(使用通配符告知最新版本)
The closest I came accross is something like:
我最近的一次经历是这样的:
<bindingRedirect oldVersion="0.0.0.0-9.9.9.9" newVersion="1.6.5135" />
(Only specify the newest version once)
(只指定最新版本一次)
1 个解决方案
#1
5
Unfortunately, the answer to this is no. See the bindingRedirect element on MSDN.
不幸的是,答案是否定的。参见MSDN上的bindingRedirect元素。
To quote:
引用:
oldVersion: Required attribute.
oldVersion:必要的属性。
Specifies the version of the assembly that was originally requested. The format of an assembly version number is major.minor.build.revision. Valid values for each part of this version number are 0 to 65535.
指定最初请求的程序集的版本。汇编版本号的格式是main .min .build.revision。此版本号的每个部分的有效值为0到65535。
You can also specify a range of versions in the following format: n.n.n.n - n.n.n.n
您还可以以以下格式指定一系列版本:n.n。n - n.n.n.n
newVersion: Required attribute. Specifies the version of the assembly to use instead of the originally requested version in the format: n.n.n.n
新版本:必要的属性。指定要使用的程序集的版本,而不是最初请求的格式:n.n
This value can specify an earlier version than oldVersion.
这个值可以指定比oldVersion更早的版本。
#1
5
Unfortunately, the answer to this is no. See the bindingRedirect element on MSDN.
不幸的是,答案是否定的。参见MSDN上的bindingRedirect元素。
To quote:
引用:
oldVersion: Required attribute.
oldVersion:必要的属性。
Specifies the version of the assembly that was originally requested. The format of an assembly version number is major.minor.build.revision. Valid values for each part of this version number are 0 to 65535.
指定最初请求的程序集的版本。汇编版本号的格式是main .min .build.revision。此版本号的每个部分的有效值为0到65535。
You can also specify a range of versions in the following format: n.n.n.n - n.n.n.n
您还可以以以下格式指定一系列版本:n.n。n - n.n.n.n
newVersion: Required attribute. Specifies the version of the assembly to use instead of the originally requested version in the format: n.n.n.n
新版本:必要的属性。指定要使用的程序集的版本,而不是最初请求的格式:n.n
This value can specify an earlier version than oldVersion.
这个值可以指定比oldVersion更早的版本。