0

I am trying to set up a project in our CI server (bamboo).

I have an API solution containing multiple projects (data access, service interfaces, WebApi, tests, a few others... you get the idea). I run nuget.exe in a script to pull in the requisite packages at the solution level. The packages go into the solution directory .nuget.

When I use MSBuild to create the binaries, everything is fine. I then use the MSTest runner on the test projects; still everything is fine. I then shut down the destination web service, and then run msbuild.exe against the WebApi project with the parameters /p:DeployOnBuild=true /p:PublishProfile=INTENV.

This is where bamboo barks at me. I get the failure error message like so:

error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\(My Solution Folder)\\.nuget\NuGet.targets.

The project is obviously looking for the dependencies in the project folder, in this case and in this case only.

How do I tell MSBuild.exe that this folder is one level up? This is the only place where it gets confused.

Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254

1 Answers1

0

So what was happening when I targeted the project instead of the solution with MSBuild.exe is that it considered $(SolutionDir) to be the project directory. It was looking for the the nuget targets at $(SolutionDir).nuget\NuGet.targets, which was an incorrect path if starting at the project level, but perfectly fine at the solution level.

On my MSBuild.exe command line, I added a parameter as follows:

/property:SolutionDir="(path of my solution)"

This did the trick.

I also tried to change the project settings, but NuGet always replaced them; the above manner is the only way I could get it to work.

Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254