I'm trying to synchronize all of the DLL versions in my solution with many projects. I noted that my app.config contains several assembly binding redirects like so:
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
</dependentAssembly>
However, as best I can tell via the NuGet package manager, there are no packages that need consolidation and all projects point to version 4.4.1 of that assembly
I tried folowing the advice of this blog post. I deleted all of the binding redirects and attempted to regenerate via:
Get-Project -All | Add-BindingRedirect
According to the NuGet Documentation Add-BindingRedirect
should check the projects output path. I am assuming this means the bin folder.
But after cleaning and rebuilding Get-Project -All | Add-BindingRedirect
still produces the same redirects in my app.config
.
Where does the NuGet Get-Project -All | Add-BindingRedirect
get its version numbers?
And where might these incorrect NuGet Package Versions be coming from?
Have a look at this Article
Starting with Visual Studio 2013, new desktop apps that target the .NET Framework 4.5.1 use automatic binding redirection. This means that if two components reference different versions of the same strong-named assembly, the runtime automatically adds a binding redirection to the newer version of the assembly in the output app configuration (app.config) file. This redirection overrides the assembly unification that might otherwise take place. The source app.config file is not modified. For example, let's say that your app directly references an out-of-band .NET Framework component but uses a third-party library that targets an older version of the same component. When you compile the app, the output app configuration file is modified to contain a binding redirection to the newer version of the component. If you create a web app, you receive a build warning regarding the binding conflict, which in turn, gives you the option to add the necessary binding redirect to the source web configuration file.
Source: Click Here to Read More about Binding Information