I’ve been trying to untangle the snarled mess that results from the old Nuget “Enable Package Restore” option. It would seem to be very simple for most things according to the official doc. And for most projects, it is exactly that easy. The problem I kept having after following the TFS steps was that no matter what I did, the Nuget.targets import line would add itself back into any web application project I removed it from. Open the .proj file, remove the line, and as soon as you reload the project, it adds the import node back in. It seems to stick more with web projects for some reason. Here’s the fix:

  1. Kill the entire Nuget folder at the solution level.
  2. Despite doing that, I had to open the .sln file in notepad and delete out the nuget block at the top.
  3. Now open the web application .proj file and delete out the nuget.targets import line.
  4. Also look for a RestorePackages node and delete it out. This will be towards the top.

Now when you reload the project file it will finally let the Nuget references go. And don’t even get me started on getting the package restore during team build on TFS working after this. Is this really the best solution?

Comments


Comments are closed