【发布时间】:2015-02-26 14:52:50
【问题描述】:
我是 C# ASP .NET MVC 的新手,所以我不确定很多事情。但是我在我的新公司继承了这个项目,我只是想构建我存储在我在这里开始时接管的计算机上的文件。我很确定自从最后一个人离开后没有人接触过这些文件,所以我认为代码应该没有问题,因为该网站现在已经上线并且正在运行。
但是当我尝试将这些文件发布到临时站点(出于测试目的)时,我得到了一堆相同的错误(删除了错误中给出的完整路径)并且项目无法发布。
Error 77 The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 15 38 Project
Error 99 The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 17 10 Project
Error 100 The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 17 10 Project
Error 115 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 18 16 Project
Error 182 The type or namespace name 'HttpPostAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 40 10 Project
Error 183 The type or namespace name 'HttpPost' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 40 10 Project
Error 186 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 41 16 Project
Error 257 The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 78 10 Project
Error 258 The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 78 10 Project
Error 265 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 79 16 Project
Error 284 The type or namespace name 'HttpPostAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 89 10 Project
Error 285 The type or namespace name 'HttpPost' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 89 10 Project
Error 291 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 90 16 Project
Error 332 The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 112 10 Project
Error 333 The type or namespace name 'Authorize' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 112 10 Project
Error 335 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 113 16 Project
Error 343 The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 121 10 Project
Error 344 The type or namespace name 'Authorize' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 121 10 Project
Error 345 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 122 16 Project
Error 363 The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 150 10 Project
Error 364 The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 150 10 Project
Error 365 The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 151 10 Project
Error 366 The type or namespace name 'Authorize' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 151 10 Project
Error 367 The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 152 16 Project
Error 377 The type or namespace name 'HttpGetAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 162 10 Project
Error 378 The type or namespace name 'HttpGet' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 162 10 Project
Error 379 The type or namespace name 'AuthorizeAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 163 10 Project
Error 380 The type or namespace name 'Authorize' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 163 10 Project
Error 384 The type or namespace name 'ActionNameAttribute' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 164 10 Project
Error 385 The type or namespace name 'ActionName' could not be found (are you missing a using directive or an assembly reference?) \Controllers\AccountController.cs 164 10 Project
对于项目中的许多文件,还有许多相同类型的错误。错误的显示方式让我相信这是一个简单的修复,因为它们几乎都是相同的错误。
有人知道如何修复这些错误,以便我可以成功构建这个项目吗?
【问题讨论】:
-
您的项目中似乎缺少对 System.Web.Mvc DLL 的引用。
-
在您的参考文献中检查损坏的参考文献并重新导入它们。
标签: c# asp.net asp.net-mvc visual-studio-2010 compiler-errors