NuGet Pack step and path resolution

I have added a NuGet Pack step to one of my builds and I'm having problems with the way it is resolving paths. The project I am compiling has the following structure:

----Project Folder
----.nuget folder
----packages folder

The project I am compiling has a NuGet dependency itself and the problem I am having is that TeamCity is looking in the wrong folder for the nuget.targets file as demonstrated by the build log:

Step 2/2: NuGet Pack

[15:35:43][Step 2/2] Cleaning c:\NuGet\xtUnit

[15:35:43][Step 2/2] pack: Create NuGet package from teamagile.xtunit\teamagile.xtunit.csproj

[15:35:43][pack] NuGet command: C:\TeamCity\buildAgent1\tools\NuGet.CommandLine.1.6.0.nupkg\tools\NuGet.exe pack c:\teamcity\buildagent1\work\fc7f117bca55ebca\teamagile.xtunit\teamagile.xtunit.csproj -OutputDirectory c:\NuGet\xtUnit -BasePath C:\TeamCity\buildAgent1\work\fc7f117bca55ebca\TeamAgile.XtUnit -Verbose -Version 1.14 -Properties Configuration=Release

[15:35:43][pack] Starting: C:\TeamCity\buildAgent1\temp\agentTmp\custom_script7410721321950394210.cmd

[15:35:43][pack] in directory: C:\TeamCity\buildAgent1\work\fc7f117bca55ebca

[15:35:43][pack] Attempting to build package from 'teamagile.xtunit.csproj'.

[15:35:43][pack] The imported project "c:\teamcity\buildagent1\work\TeamAgile.XtUnit\.nuget\nuget.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  c:\teamcity\buildagent1\work\fc7f117bca55ebca\teamagile.xtunit\teamagile.xtunit.csproj

[15:35:43][pack] Process exited with code 1

[15:35:43][Step 2/2] Step NuGet Pack failed

So as you can see it is looking one level too high for the nuget.targets file, I'm guessing this is because the csproj file knows that it is one-level up but TeamCity is starting from the solution folder when it is calculating the relative path.

Is there anyway to fix this?
1 comment
Comment actions Permalink

Please see/vote and apply the workaround from it.


Please sign in to leave a comment.