0

I added Web.Api 2.2 project in the solution, which builds correctly. I added some RoutePrefix and Route attributes to actions in controller.

Everything builds correctly, but TFS build throws errors:

BackOffice\Dev\Test.Solution\Test.Project.Api\Controllers\ValuesController.cs
(10, 6) The type or namespace name 'RoutePrefix' could not be found (are you missing a using directive or an assembly reference?) BackOffice\Dev\Test.Solution\Test.Project.Api\Controllers\ValuesController.cs
(22, 16) The type or namespace name 'IHttpActionResult' could not be found (are you missing a using directive or an assembly reference?) BackOffice\Dev\Test.Solution\Test.Project.Api\Controllers\ValuesController.cs
(20, 10) The type or namespace name 'Route' could not be found (are you missing a using directive or an assembly reference?) Unexpected exit code received from msbuild.exe: 1

I've tried to delete project, check-in, TFS rebuilds. I've recreated same project, rebuild, check-in, but TFS fails to rebuild.

Is there any diagnostic tool to see if anything is missing on TFS?

sensei
  • 7,044
  • 10
  • 57
  • 125

1 Answers1

0

You need to restore the WebApi NuGet package in TFS. Please check my reply in this case for the detailed steps: TFS 2013 Build Controller Not Respecting NuGet Package Restore

As we know that builds run on TFS build agent machine, however, the WebApi package is missing from that build agent machine (the type RoutePrefix, IHttpActionResult, Route shown in the build logs all from Microsoft ASP.NET Web API package) So, what you need is to restore NuGet during the TFS build process to avoid adding all Nuget package dlls into TFS version control.

Community
  • 1
  • 1
Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22