简体   繁体   English

命名空间“System.Web”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?)

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

Whenever I try to compile my VS2015 application, I a long list of errors like:每当我尝试编译我的 VS2015 应用程序时,都会出现一长串错误,例如:

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

However, as soon as I double click the error to view the file, it opens the file, has a slight delay, then clears ALL the errors.但是,只要我双击错误以查看文件,它就会打开文件,稍有延迟,然后清除所有错误。

If I proceed to try and build again, I get the same list of errors and the process repeats itself.如果我继续尝试再次构建,我会得到相同的错误列表,并且该过程会重复。

UPDATE I forgot to mention that I have tried:更新我忘了提到我已经尝试过:

  1. following the advice in several other SO questions - to no avail遵循其他几个 SO 问题中的建议 - 无济于事
  2. ensuring the dlls are set to copy to local确保将 dll 设置为复制到本地
  3. removing and re-adding references删除和重新添加引用
  4. deleting dlls from the application and adding them back从应用程序中删除 dll 并将它们添加回来
  5. cleaning and rebuilding the application清理和重建应用程序
  6. restarting the application and my computer重新启动应用程序和我的电脑

What would cause this?什么会导致这种情况? How do I eliminate it?我该如何消除它?

  • Restart Visual studio重新启动视觉工作室
  • Remove the assembly reference and re-add it删除程序集引用并重新添加
  • Do a clean and re-build进行清理并重新构建
  • Try install Microsoft.AspNET.MVC from nuget package manager尝试从 nuget 包管理器安装 Microsoft.AspNET.MVC

in my case it worked only after I run in the Package Manager Console following command在我的情况下,它仅在我在包管理器控制台中运行以下命令后才起作用

PM> Install-Package Microsoft.AspNet.Mvc

My environment was:我的环境是:

1) Visual Studio 2017
2) Freshly created Angular 4 app
3) MVC 6 as a back end

尝试下载并将 System.Web.Mvc.dll 复制到您的项目 bin 文件夹中

暂无
暂无

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

相关问题 命名空间“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 命名空间“System.Web”中不存在类型或命名空间名称“UI”(您是否缺少程序集引用?) - The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) CS0234:类型或名称空间名称“ WebPages”在名称空间“ System.Web”中不存在(您是否缺少程序集引用?) - CS0234: The type or namespace name 'WebPages' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 命名空间“System.Web.UI”中不存在类型或命名空间名称“DataVisualization”(您是否缺少程序集引用?) - The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?) 类型或名称空间名称在名称空间中不存在“是否缺少程序集引用?” - The type or namespace name does not exist in the namespace ''are you missing an assembly reference ?" 命名空间中不存在类型或命名空间名称(您是否缺少程序集引用?) - The type or namespace name does not exist in the namespace (are you missing an assembly reference?) 类型或名称空间名称“ 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' CS0234:类型或名称空间名称“ Description”在名称空间“ System.Web.Http”中不存在(您是否缺少程序集引用?) - CS0234: The type or namespace name 'Description' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM