Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet "Failed to generate binding redirects for My Project" with error "Object reference not set to an instance of an object."

On several different packages like SquishIt and DotNetOpenAuth i get an error saying:

Failed to generate binding redirects for 'MyProject'. Object reference not set to an instance of an object.

I've seen a lot of post about other people having problems with "binding redirects" but not found a single reference to this problem combined with "Object reference not set to an instance of an object.".

What exactly is NuGet trying to do at this stage? Does it try to update the binding redirects in Web.Config? Could i have some issue with my Web.Config? How can i go about debugging this?

I shall say that this does not happen in a "clean" project.

like image 800
Olaj Avatar asked Dec 05 '12 09:12

Olaj


2 Answers

I had the same issue mucking around with MVC versions in one project. I think it could happen for any NuGet package that tries to add Binding Redirects to your config file.

I ended up renaming "Web.config" to "Web.Temp.Config", then installing the package.

I then I manually merged the changes that the package put into my config file into the temp one, then deleted it and renamed my original back to web.config.

This resolved the issue for me - hopefully it helps you.

like image 73
nootn Avatar answered Oct 15 '22 04:10

nootn


In my case, update NuGet Package Manager solves the problem.

like image 31
Maxwell Avatar answered Oct 15 '22 06:10

Maxwell