Search code examples
c#visual-studiomsbuildnugetpackage-manager-console

"Failed to update binding redirects for .." during nuget consuming in Package Manager Console


When I consume a nuget via Install-Package command from Package Manager Console:

Install-Package -ProjectName ### -Id Package -Version 1.0.0 -Source nuget.org

I see the below warning on my work machine:

..
Added package 'Package.1.0.0' to 'packages.config'
Successfully installed 'Package 1.0.0' to ConsoleApp1
Failed to update binding redirects for 
ConsoleApp1\ConsoleApp1.csproj : 
Exception has been thrown by the target of an invocation.
Executing nuget actions took 21.27 sec

However the same package for a project with very similar structure I created on my own machine has been consumed successfully without any warnings.

I wonder what is this warning about? My project is empty, so I have no app/web.config files. So, not sure what exactly fails. Any help would appreciated.

Update: adding the below configuration to the project file didn't help:

<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>

Update2: Apperently this issue happens only in VS2022, I don't see it in VS2019 for some reason


Solution

  • Try to disable the binding redirects, add this setting to the csproj:

    <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>