从升级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'

查看:638
本文介绍了从升级MVC 3.X解决MVC 5.2.3:类型或命名空间名称的mvc'不会在命名空间“System.Web程序”存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个解决方案,是使用VS 2010和MVC 3.something建原稿。我现在使用VS 2015年和MVC 5.2.3。我删除了旧参考MVC3,并改为5.2.3 DLL。现在,每当我尝试构建解决方案,我收到此错误的多个实例:

I have a solution that was originals built using VS 2010 and MVC 3.something. I am now using VS 2015 and MVC 5.2.3. I deleted the old reference to MVC3 and changed it to the 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?)  

在每个文件(类)发生的错误,当我尝试使用System.Web.MVC:

The error happens in each file (class) when I try to use 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:


  • 创建使用MVC5,然后将Web配置文件从全新的解决方案到现有的解决方案复制VS2015一个新项目。无论是在根,并在视图文件夹

  • 确信复制本地的裁判System.Web.MVC设置为True

任何其他建议?

推荐答案

有没有解决多个项目?这有可能是其他项目之一引用MVC的旧版本。

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 3.X解决MVC 5.2.3:类型或命名空间名称的mvc'不会在命名空间“System.Web程序”存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆