3

We are trying to auto-update NuGet packages in our projects with a nightly build. The reason for this is that we use an internal NuGet repository for sharing the latest version of some shared library code, and we want all our projects to use the latest.

Running nuget.exe update sort of works, BUT, it does not add binding redirects to app.config and web.config. When updating through the NuGet package manager or the Visual Studio package manager UI, binding redirects are added. The potential solutions I've thought of so far are:

  • Adding binding redirects programatically when updating packages. This sounds messy to me.
  • Somehow invoke Visual Studio's package manager console from outside Visual Studio. I don't know if this is even possible?

Can anyone think of a solution to this? If so, I'd be very thankful! It's been bugging me for a couple of days now.

Hallgeir
  • 1,213
  • 1
  • 14
  • 29
  • I don't think that second solution is possible, take a look at [NuGet docs](https://docs.nuget.org/consume/nuget-faq#can-i-use-nuget-outside-of-visual-studio?) – Tom Kuijsten Sep 22 '15 at 20:10
  • I've kind of come to the same conclusion myself... so I guess what we'll do is update all manually through visual studio, using a solution with all projects. – Hallgeir Sep 23 '15 at 06:27

1 Answers1

0

I ran into the same issue again a little while ago and created Add-BindingRedirect as a result. Packages are downloadable from the releases page.

There's an Add-BindingRedirect.exe which you can invoke from your solution root folder. It will add binding redirects to all of the [web|app].config files that it finds.

Usage:

\path\to\nuget\nuget.exe update
\path\to\Add-BindingRedirect\Add-BindingRedirect.exe
uglybugger
  • 905
  • 9
  • 7
  • Note: Running the `nuget update` command from the command prompt does not run PowerShell post-installation scripts, so you still might have to drop into Visual Studio on occasion. The [OctoPack](https://github.com/OctopusDeploy/OctoPack) package is a good case in point here. – uglybugger Sep 20 '16 at 07:00