I have recently started to implement an automated build for our software suite using TFS. I am trying to install as little as possible on the build server and would like to avoid checking in third party libraries to our source repository.
One of our projects fails the build with with a missing dependency:
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
This is not surprising, as I don't have Visual Studio (or Team Explorer etc.) installed on the build server. In an effort to work around this issue, I am trying to use NuGet with automatic package restore to provide the appropriate library (MSBuild.Microsoft.VisualStudio.Web.targets). I have read a ton of posts both here and elsewhere, but have not been able to get this to work properly. Basically, I:
- Set an environment variable on the build server: EnableNuGetPackageRestore=true
- Followed the instructions at: http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages
- Added all files in SolutionDir.nuget to the TFS repository.
- Add the packages folder and respositories.config to the TFS repository.
- Verified that nuget.targets was referenced from the offending project.
- Verified that 'RestorePackages' was set to true in the offending project.
- Shelved all these items and queued a private build with the proper shelveset.
The build runs, but the nuget packages are never downloaded. Further to that, I don't see any log entries for any 'RestoreCommand' (or other items from the nuget.targets) in the build log file. It is like the nuget.targets is completely ignored. I'm hoping I've just been looking at this too long and have missed some simple step.
Edit: I should have mentioned that the solution builds fine on a local machine. I have updated the project references to reference the libraries from NuGet. If I delete all the local packages it downloads them and builds properly.