Automatic Binding Redirects
There's a warning that will auto generate your missing redirects.
- Clean your project
- Build your project
- Go to the Error List filter and activate the warning filter
- Filter warnings for your main project
- Look for a warning with a message like this:
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file
- Follow the message. Click it!
Update: You'll have to activate the warning in the project properties -> Application -> Auto-generate binding redirects
This is because the source app.config is not modified, only output (the one created in a compilation step and placed in your Debug / Release folder) application configuration file is.
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.
Source
Redirects in your source app.config were generated by Nuget itself. You have triggered it by making changes to the packages.
Check this article out:
https://weblog.west-wind.com/posts/2014/Nov/29/Updating-Assembly-Redirects-with-NuGet
There is a command to force Nuget re-write all the assembly redirects in solution's config files.
Just try this on Package Manager Console:
PM> Get-Project –All | Add-BindingRedirect
I had success generating the redirects with editing my .csproj file and adding one of these:
<Target Name="ForceGenerationOfBindingRedirects"
AfterTargets="ResolveAssemblyReferences"
BeforeTargets="GenerateBindingRedirects"
Condition="'$(AutoGenerateBindingRedirects)' == 'true'">
<PropertyGroup>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
</Target>
or
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>