nuget.targets was not found

Automated deployment for web applications and databases

Moderators: Mike Upton, justin.caldicott, Sean.newham, csmith, chirayu, DavidSimner, david.conlin

nuget.targets was not found

Postby pantarhei » Tue Sep 10, 2013 2:21 pm

I'm trying to publish an application package with the VS addon. As soon I try to publish I get the following error:

Code: Select all
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.

Code: Select all
<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?
pantarhei
 
Posts: 2
Joined: Tue Sep 10, 2013 2:17 pm

Postby DavidSimner » Tue Sep 10, 2013 2:56 pm

In order to create the package, the Deployment Manager VS extension will compile your code, so that it can put the compiled binaries into the package.

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:
Code: Select all
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\\</SolutionDir>

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.
DavidSimner
 
Posts: 49
Joined: Thu Feb 04, 2010 6:05 pm

Postby pantarhei » Tue Sep 10, 2013 3:50 pm

Great hint. Looks like that fixed my issue. Don't know how long it would have taken me to find. :)
pantarhei
 
Posts: 2
Joined: Tue Sep 10, 2013 2:17 pm


Return to Deployment Manager

Who is online

Users browsing this forum: No registered users and 0 guests

cron