Friday, February 26, 2016

Visual studio solution nuget targets not found on opening project

When attempting to open a visual studio project that contains nuget packages from a custom source on another environment, the following error may appear:
The imported project [project location]\.nuget\nuget.targets was not found. Confirm the parth in the <import> declaration is correct, and that the file exists on disk. [project location]\[project name].csproj
The fix here is to open the project file (csproj) in notepad and remove the following lines:
<RestorePackages>true</RestorePackages>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
 Then also remove the .nuget folder if it is present as well.

No comments:

Post a Comment