我正在尝试为.Net MVC项目在TeamCity中建立一个构建。我遵循了这里描述的步骤:如何在TeamCity中构建ASPNET应用程序
但建筑仍在失败。我拥有的错误消息是
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文件夹中的文件。
我要怎么做才能建立和运行呢?
非常感谢。
发布于 2014-12-03 09:56:47
我终于解决了这个问题。我所做的是将NuGet包上传到源代码存储库,并删除TeamCity配置中的NuGet步骤。实际上,我更希望这个选项能够在我的代码中工作,尽管NuGet已经关闭。
非常感谢。
发布于 2015-09-08 14:03:20
您需要在构建过程中添加一个步骤来恢复所有NuGet包。有关说明,请参见这里。
发布于 2014-11-27 03:47:17
System.Web.Optimization命名空间不在System.Web.dll程序集中。它有自己的装配,System.Web.Optimization.dll。添加该DLL作为引用。如果你没有那个DLL,可以通过NuGet获得它。我认为这是正确的包。
https://stackoverflow.com/questions/27161006
复制相似问题