nuget.targets was not found
pantarhei
Posts: 3
I'm trying to publish an application package with the VS addon. As soon I try to publish I get the following error:
In my csproj file I have the following line. I think it belongs somehow to the nuget package restore.
But I have no idead why the addon tries to load something from the project root. Any help on this?
An error occurred while creating and pushing the package The imported project "C:\Projects\.nuget\nuget.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\Projects\MyProject\Web\MyProject.Web.csproj
In my csproj file I have the following line. I think it belongs somehow to the nuget package restore.
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
But I have no idead why the addon tries to load something from the project root. Any help on this?
Comments
From the error message, it looks like it was failing to compile your code.
Can you check your C:\Projects\MyProject\Web\MyProject.Web.csproj file in Notepad for me. Does it have this line (or something like it) in the first PropertyGroup: My hunch is that it has this line with the value "..\..\" instead of "..\". Try switching to "..\", reloading the project in VS, repackaging it, and see what happens.
The background is that SolutionDir isn't set by our VS extension, and normally NuGet would automatically add that line so that the csproj still compiles even if SolutionDir isn't set. It looks like SolutionDir is being set to the wrong thing by the csproj, which causes the nuget.targets file to not be found error to happen.