Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic Binding Redirects

Running VS 2017, latest update.

The documentation states that to enable automatic binding redirection you modify the csproj file and add the following under the appropriate <PropertyGroup>:

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 

Historically my project has had a few binding redirect entries in the app.config. I recently updated all nuget packages for the solutions and in the commit it modified several of the binding redirect entries to match the new version.

I wanted to make sure that everything was good to go for QA so I deleted all entries in the App.Config thinking that they would be regenerated on the next build (as the docs suggest they will).

To my surprise nothing has been added to the app.config on a clean / build.

So my question is, is it safe to assume that by consolidating dependencies in the solutions I no longer need them?

Or is there something wrong and VS should be generating the redirects and its failing.

like image 541
Wjdavis5 Avatar asked Oct 19 '17 15:10

Wjdavis5


People also ask

What is automatic binding redirection?

Binding redirects are added if your app or its components reference more than one version of the same assembly, even if you manually specify binding redirects in the configuration file for your app. The automatic binding redirection feature affects desktop apps that target . NET Framework 4.5. 1 or a later version.

How do I add-BindingRedirect?

Open the NuGet Package Manager Console, specify the appropriate Default Project and enter the command Add-BindingRedirect. As if by magic, an app. config is added to the project (if one doesn't exist already) and the appropriate information added. Sweet!


1 Answers

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 
like image 86
Jackson Mourão Avatar answered Oct 03 '22 12:10

Jackson Mourão