asp.net - 无法在 TeamCity 中构建 .Net MVC 项目

标签 asp.net asp.net-mvc teamcity

我正在尝试在 TeamCity 中为 .Net MVC 项目设置构建。我按照此处描述的步骤操作:How to build ASPNET applications in TeamCity

但是构建仍然失败。我收到的错误消息是

App_Start\BundleConfig.cs(2, 18): error CS0234: The type or namespace name 'Optimization' does 

not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\FilterConfig.cs(2, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\RouteConfig.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\HomeController.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Controllers\HomeController.cs(9, 35): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) 
Global.asax.cs(5, 18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
Global.asax.cs(6, 18): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 
App_Start\BundleConfig.cs(9, 44): error CS0246: The type or namespace name 'BundleCollection' could not be found (are you missing a using directive or an assembly reference?) 
App_Start\FilterConfig.cs(8, 50): error CS0246: The type or namespace name 'GlobalFilterCollection' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(11, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(16, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 
Controllers\HomeController.cs(23, 16): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) 

我在 csproj 中拥有 Copy Local = true 和 True 的所有引用。 TeamCity 正在正确下载 nuget 包,但似乎没有使用它们。我所能看到的是,在 obj/Release 的 .csprojResolveAssemblyReference 文件中,有以下行:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\System.Web.dll

因此,似乎正在使用该文件,而不是 nuget 文件夹中的文件。

我需要做什么才能构建并运行?

非常感谢。

最佳答案

您需要在构建过程中添加一个步骤来恢复所有 NuGet 包。 请参阅here获取说明。

关于asp.net - 无法在 TeamCity 中构建 .Net MVC 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27161006/

相关文章:

javascript - 共享点 2010 : custom column with javascript

asp.net-mvc - Azure 上的 Facebook 应用程序使用 ASP.NET MVC Facebook 模板(API 错误代码 : 191)

c# - 从 DataRow 获取值(value)的最佳方式是什么?

c# - 编译错误 - 编译器失败,错误代码为 1

asp.net - Global.asax Application_start 在每个 Action 上触发

teamcity - 如何获取在 TeamCity 中触发构建的用户的电子邮件地址?

continuous-integration - 如何在没有 Web 部署项目的情况下在 VS 2012 中处理 Web 应用程序项目的构建?

git - Teamcity - 无需构建即可推送更改(在提交消息中)

asp.net - 设置在右侧的图像

c# - 如何在 javascript 和 asp.net 中获取客户端 ID 值?