首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在.Net中构建TeamCity MVC项目

问无法在.Net中构建TeamCity MVC项目
EN

Stack Overflow用户
提问于 2014-11-27 00:05:22
回答 3查看 5.6K关注 0票数 4

我正在尝试为.Net MVC项目在TeamCity中建立一个构建。我遵循了这里描述的步骤:如何在TeamCity中构建ASPNET应用程序

但建筑仍在失败。我拥有的错误消息是

代码语言:javascript
复制
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 = true和True的引用。TeamCity正在正确下载nuget软件包,但似乎没有使用它们。我所能看到的是,在obj/Release中的.csprojResolveAssemblyReference文件中有以下一行:

C:\程序文件(x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\System.Web.dll

所以,它似乎是使用该文件,而不是在nuget文件夹中的文件。

我要怎么做才能建立和运行呢?

非常感谢。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-12-03 09:56:47

我终于解决了这个问题。我所做的是将NuGet包上传到源代码存储库,并删除TeamCity配置中的NuGet步骤。实际上,我更希望这个选项能够在我的代码中工作,尽管NuGet已经关闭。

非常感谢。

票数 0
EN

Stack Overflow用户

发布于 2015-09-08 14:03:20

您需要在构建过程中添加一个步骤来恢复所有NuGet包。有关说明,请参见这里。

票数 3
EN

Stack Overflow用户

发布于 2014-11-27 03:47:17

System.Web.Optimization命名空间不在System.Web.dll程序集中。它有自己的装配,System.Web.Optimization.dll。添加该DLL作为引用。如果你没有那个DLL,可以通过NuGet获得它。我认为这是正确的包。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27161006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档