Visual Studio 2015新MVC项目 - Microsoft.Aspnet中不存在mvc

Sha*_*han 9 asp.net-mvc asp.net-mvc-5 visual-studio-2015

我在Visual Studio 2015中遇到错误我使用的是Windows 8.1和visual studio 2013,所有使用asp.net MVC 5的项目都正常运行并且没有任何错误.

自从我安装了Windows 10和visual studio 2015以来,我的整个ASP.NET MVC 5项目都运行不正常.

我在visual studio 2015中创建了新的默认模板来检查它们.我在这些新项目上也遇到了同样的错误.

我得到错误:

CS0234命名空间"Microsoft.AspNet"中不存在类型或命名空间名称"Mvc"(您是否缺少程序集引用?)

当前上下文中不存在名称"布局".

**我已经尝试过的事情:**

  1. 修复VS 2015.
  2. 从Nuget卸载并安装了Install-Package Microsoft.AspNet.Mvc
  3. 复制Local = True
  4. System.web.MVC已经被引用.
  5. web.config的版本都放在5.2.3.0中

Sha*_*han 3

我按照以下步骤完全重新安装Visual Studio 2015,解决了问题。修复没有成功

  1. 运行命令

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /resetuserdata

  2. 下载 Web 安装程序安装文件并在下载的目录中运行以下命令

    vs_community.exe /卸载/强制

  3. 卸载后确保没有安装与VS相关的文件软件并重新启动PC

  4. 使用 Web 安装程序安装了新的 Visual Studio。
  5. 再次运行命令。

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe /resetuserdata

  6. Visual Studio 中提供了更新,并安装了它们 - 重新启动 Visual Studio

  7. 现在打开任何 ASP.NET MVC 解决方案,虽然在启动时需要一些时间,但之后它就可以工作了。