sensei
sensei

Reputation: 7592

TFS Build doesn't build with WebAPI project

I created simple WebAPI project: enter image description here

Then I checked in to TFS and for some reason clean project doesn't build with msbuild on TFS.

Errors I get are following: http://pastebin.com/ZPBEFcPN

Packages content:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net452" />
  <package id="bootstrap" version="3.0.0" targetFramework="net452" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="jQuery" version="1.10.2" targetFramework="net452" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="1.2.0" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.JavaScript" version="0.15.0-build58334" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.Web" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.WindowsServer" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="1.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.EntityFramework" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net452" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.HelpPage" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net452" />
  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
  <package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Cookies" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Facebook" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Google" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.MicrosoftAccount" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Owin.Security.Twitter" version="3.0.1" targetFramework="net452" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
  <package id="Modernizr" version="2.6.2" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
  <package id="Owin" version="1.0" targetFramework="net452" />
  <package id="Respond" version="1.2.0" targetFramework="net452" />
  <package id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages>

Csproj content: http://pastebin.com/VR2iXs2A

This is a project made from scratch, nothing added.

Upvotes: 0

Views: 215

Answers (3)

sensei
sensei

Reputation: 7592

For some reason I forgot to enable "Restore Nuget packages" option on build step.. don't ask.. enter image description here

Just to mention correct way to restore packages as per v2.7+ is to add Nuget installer step before build step: enter image description here

Upvotes: 0

granadaCoder
granadaCoder

Reputation: 27904

Run

nuget.exe restore MySolution.sln

or

nuget.exe restore MyCsProj.csproj

before you attempt the tfs build. Aka, on the TFS machine.

This is the "newer" way of restoring packages.

From

https://docs.nuget.org/consume/package-restore

Important: Nuget Automatic Package Restore has changed in Nuget 2.7+. Do not mix 'old' and new methods for automatic package restoration. For more information, see Common Issues with Automatic Package Restore, below.

Since you "checked that box" you may have to follow these instructions.

https://docs.nuget.org/Consume/Package-Restore/Migrating-to-Automatic-Package-Restore

Upvotes: 1

chief7
chief7

Reputation: 14393

If you are using the MVC Nuget packages you should enable Nuget restore.

If you aren't using the Nuget packages you need to use the bin deployed MVC references by right clicking on the project and choosing "Add Deployable Dependencies".

enter image description here

Upvotes: 0

Related Questions