简体   繁体   中英

TFS Build doesn't build with WebAPI project

I created simple WebAPI project: 在此处输入图片说明

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.

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

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".

在此处输入图片说明

For some reason I forgot to enable "Restore Nuget packages" option on build step.. don't ask.. 在此处输入图片说明

Just to mention correct way to restore packages as per v2.7+ is to add Nuget installer step before build step: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM