Red Gate forums :: View topic - nuget.targets was not found
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
Deployment Manager
Deployment Manager forum

nuget.targets was not found

Search in Deployment Manager forum
Post new topic   Reply to topic
Jump to:  
Author Message
pantarhei



Joined: 10 Sep 2013
Posts: 2

PostPosted: Tue Sep 10, 2013 2:21 pm    Post subject: nuget.targets was not found Reply with quote

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

Code:
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:
<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?
Back to top
View user's profile Send private message
DavidSimner



Joined: 04 Feb 2010
Posts: 49

PostPosted: Tue Sep 10, 2013 2:56 pm    Post subject: Reply with quote

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:

    <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.
Back to top
View user's profile Send private message
pantarhei



Joined: 10 Sep 2013
Posts: 2

PostPosted: Tue Sep 10, 2013 3:50 pm    Post subject: Reply with quote

Great hint. Looks like that fixed my issue. Don't know how long it would have taken me to find. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group