Tuesday, June 04, 2013

Completely Uninformative Nuget Error

Using Visual Studio, you get this error upon opening a solution you haven't opened in awhile:

[Referenced Project].csproj : error  : The imported project "[Your Solution]\.nuget\nuget.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.  [Referenced Project].csproj

The reason is that (I think) nuget has not been enabled for this solution which references a project that contains a nuget referenced assembly, which nuget reference has been set when the other solution is open.

Solution: Right click on the solution and select "Enable Nuget Package Restore."  Now you should be able to reload the offending project(s) without error.

I couldn't find a solution when I searched; hope this helps somebody.