Build error: found not NuGet.Targets if build on TFS

Topics: Developer Forum, User Forum
Feb 25, 2012 at 9:03 AM

Hello.

I'm trying to use SHFB together with a solution that is configured with automatic package restore. But I didn't find a configuration where SHFB build the help file on TFS.

What did I do:
- created a new solution and added a c# project
- configure NuGet package managment to restore packages automatically (new with NuGet 1.6) with context menu command "Enable NuGet Package Restore"
- added new SHFB project

When I build solution now, then SHFB failed with: ... not found NuGet.targets  (this target lives in folder ".nuget" on solution level).
- I added <Import Project="..\.nuget\nuget.targets" /> into the SHFB-project file

Now the solution builds correct on my workstation, but if I let TFS build the solution, then I have got an error message, that NuGet.targets not found.
SHFB searches for the target in:
"d:\tfs\Builds\DefaultCollection\1\TestSolution\Complete\DEVELOPMENT\.nuget\nuget.targets"
but this target lives on the buildagent in
"d:\tfs\Builds\DefaultCollection\1\TestSolution\Complete\Sources\.nuget\nuget.targets".
(the configured workspace in processtemplate is "$\...    ...\DEVELOPMENT\ )

Any idea how to resolve this issue?

Bye, Stefan

Coordinator
Feb 27, 2012 at 10:02 PM

You could probably add a conditional property to the project that sets the path to the nuget.targets file based on the configuration (debug or release).

Eric