添加对.NET扩展的引用后,TeamCity构建失败

时间:2015-05-04 18:20:08

标签: visual-studio-2012 msbuild continuous-integration teamcity

我在VS2012解决方案中添加了4个对项目扩展的引用。项目文件(.vbproj)更改为:

    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL">

sol在我的本地环境中成功构建。但是,当推送到TeamCity时,我得到编译/ MSBuild失败。消息表明未定义引用库中的类。

...error BC30002: Type 'ApiController' is not defined. 
...error BC30002: Type 'HttpResponseException' is not defined. 
...error BC30456: 'MapHttpRoute' is not a member of 'System.Web.Routing.RouteCollection'. 

.sln文件似乎有正确的信息引用所有项目,包括修改后的项目,但我似乎缺少一些东西。任何人都可以提供建议。感谢。

1 个答案:

答案 0 :(得分:0)

我假设Team City在另一台机器上运行?

https://www.microsoft.com/en-us/download/details.aspx?id=8279

在Team City Build Machine上安装DotNet 4.0 SDK。

(关于一个版本的链接....将DotNet与构建机器的O / S相匹配)....

APPEND:

我不知道你在使用NUGET。

设置依赖项时,您在开发人员计算机上手动调用了NUGET。

您必须设置构建计算机才能执行此操作。

请参阅:

http://geekswithblogs.net/TarunArora/archive/2014/09/14/auto-restore-nuget-packages-with-tfs-build-the-right-way.aspx

或者

http://www.brendanforster.com/doing-the-build-server-dance-with-nuget.html

此链接应始终在:

How do I Enable NuGet Package Restore in Visual Studio 2015

由于这些链接可能会死亡,因此关键短语是:

启用NuGet包恢复

APPEND:

这个nuget电话:

Install-Package Microsoft.AspNet.WebApi.Client -Version 4.0.30506

添加了此参考:

  .. \包\ Microsoft.AspNet.WebApi.Client.4.0.30506.0 \ LIB \ net40 \ System.Net.Http.Formatting.dll