简体   繁体   English

将解决方案从MVC 3.x升级到MVC 5.2.3:类型或名称空间名称“ Mvc”在名称空间“ System.Web”中不存在

[英]Upgrading solution from MVC 3.x to MVC 5.2.3: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web'

I have a solution that was originals built using VS 2010 and MVC 3.something. 我有一个解决方案,它是使用VS 2010和MVC 3.something构建的。 I am now using VS 2015 and MVC 5.2.3. 我现在正在使用VS 2015和MVC 5.2.3。 I deleted the old reference to MVC3 and changed it to the 5.2.3 dll. 我删除了对MVC3的旧引用,并将其更改为5.2.3 dll。 Now, whenever I try to build the solution, I receive multiple instances of this error: 现在,每当我尝试构建解决方案时,都会收到此错误的多个实例:

Error   CS0234  The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  

The error happens in each file (class) when I try to use System.Web.MVC: 当我尝试使用System.Web.MVC时,每个文件(类)中都会发生错误:

using System.Web.Mvc;

The reference DOES exist. 参考确实存在。 The odd thing is, if I remove this line in a given file, and replace it with the exact same thing, the error for that file will temporarily vanish, but will then come back at some seemingly random point in the future when I build again. 奇怪的是,如果我删除给定文件中的这一行,并用完全相同的东西替换它,则该文件的错误将暂时消失,但是在以后再次构建时,它将在某个看似随机的位置返回。

Based on some other threads of a similar nature, here's a couple things I have tried: 基于其他类似性质的线程,这是我尝试过的几件事:

  • Create a new project in VS2015 using MVC5, then copy the Web Config files from the new solution into the existing solution. 使用MVC5在VS2015中创建一个新项目,然后将Web Config文件从新解决方案复制到现有解决方案中。 Both in the root, and in the Views folder 在根目录和“视图”文件夹中
  • Made sure Copy Local on the ref to System.Web.MVC is set to True 确保将对“复制到System.Web.MVC”的引用上的“本地复制”设置为True

Any other suggestions? 还有其他建议吗?

Is there more than one project in the solution? 解决方案中是否有多个项目? It's possible that one of the other projects is referencing an older version of MVC. 其他项目之一可能引用的是旧版本的MVC。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命名空间system.web中不存在Mvc - Mvc does not exist in the namespace system.web 命名空间“System.Web”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?) - The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 命名空间“System.Web”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?)Kentico - The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Kentico Visual Studio:名称空间“ System.Web”中不存在类型或名称空间名称“ Mvc” - Visual Studio : The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' 命名空间“System.Web.Mvc”中不存在类型或命名空间名称 - The type or namespace name does not exist in the namespace 'System.Web.Mvc' 类型或名称空间名称“ Routing”在名称空间“ System.Web”中不存在 - The type or namespace name 'Routing' does not exist in the namespace 'System.Web' 命名空间“System.Web”中不存在类型或命名空间名称“优化” - The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' 类型或名称空间名称“ Http”在名称空间“ System.Web”中不存在 - The type or namespace name 'Http' does not exist in the namespace 'System.Web' 命名空间'system.web'visual studio中不存在类型或命名空间名称'routing' - The type or namespace name 'routing' does not exist in the namespace 'system.web' visual studio 错误:名称空间“ System.Web”中不存在类型或名称空间名称“ Configuration” - Error: The type or namespace name 'Configuration' does not exist in the namespace 'System.Web'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM