Having an ASP.NET application there are several entries in the Web.Config file in this format:
<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.
Now every time I update my 20+ NuGet packages I do something like:
This is very annoying.
My question:
Is there a way to tell the bindingRedirect
entry to always use the latest version?
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)
Unfortunately, the answer to this is no. See the bindingRedirect element on MSDN.
To quote:
oldVersion: Required attribute.
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.
You can also specify a range of versions in the following format: 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
This value can specify an earlier version than oldVersion.