TFS Build不使用WebAPI项目

时间:2016-03-22 18:09:00

标签: asp.net-web-api tfs msbuild

我创建了简单的WebAPI项目: enter image description here

然后我检查了TFS,由于某种原因,干净的项目没有在TFS上使用msbuild构建。

我得到的错误如下: http://pastebin.com/ZPBEFcPN

包裹内容:

<?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内容: http://pastebin.com/VR2iXs2A

这是一个从零开始制作的项目,没有添加任何内容。

3 个答案:

答案 0 :(得分:1)

运行

nuget.exe restore MySolution.sln

nuget.exe restore MyCsProj.csproj
在尝试构建tfs之前

。 Aka,在TFS机器上。

这是恢复包裹的“更新”方式。

来自

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

重要:Nuget 2.7+中的Nuget自动包恢复已更改。 请勿混用“旧”和新方法进行自动包修复。有关详细信息,请参阅下面的自动包还原常见问题。

由于您“选中了该框”,因此您可能必须遵循这些说明。

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

答案 1 :(得分:0)

如果您正在使用MVC Nuget包,则应启用Nuget还原。

如果您没有使用Nuget包,则需要通过右键单击项目并选择“Add Deployable Dependencies”来使用bin部署的MVC引用。

enter image description here

答案 2 :(得分:0)

出于某种原因,我忘了启用&#34;恢复Nuget包&#34;构建步骤的选项..不要问.. enter image description here

提及按照v2.7 +恢复软件包的正确方法是在构建步骤之前添加Nuget安装程序步骤: enter image description here