Team Foundation Service build fails on NuGet package restore

benjy picture benjy · Sep 24, 2013 · Viewed 22k times · Source

I'm having kind of an odd problem with my Team Foundation Service build. I queue it up and it starts just fine, but then it fails with the following error:

C:\a\src\Platform\Prod\Platform.Web\Platform.Web.csproj (436): The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568.

So then I re-queue the build per the message/URL and...it happens again. I've Googled around but I can't seem to figure out what the issue is. I can build just fine in Visual Studio and the solution is configured for package restore. Any thoughts?

Thanks in advance.

Answer

Michael Logutov picture Michael Logutov · Oct 23, 2013

If someone still having this issue on tfs build server you need to go the following:

  1. Make sure all projects in solution you attempt to build have the latest Microsoft.Bcl.Build package (just update it in package manager).
  2. After build failed see all project (in tfs build log summary) that generate this error ("The build restored NuGet packages ...")
  3. Open each of those project's .proj file and comment out whole target element started with 'Target Name="EnsureBclBuildImported"'
  4. Check in and retry the build

It seems somehow after upgrading not all projects get those old block of build code removed and it's causing problems (as I understand it it's not longer needed after microsoft changed their bcl build process).