CS0234 The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
CS0246 The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
问题描述:
打开一个现有的项目,添加一个 Web API Controller Class,就会现在该问题;如下图:
解决方案一:
此方案用于正常情况,我们可以看到上图中Mvc下面出现了红色的波浪线,把鼠标移动到Mvc上,会弹出一个提示框,如下图:
然后点击 Show potential fixes(显示可能的/可用的修复方法),如下图:

当遇到CS0234和CS0246错误,即'Mvc'类型或命名空间在'Microsoft.AspNet'中不存在时,可以尝试两种解决方案。一是通过Show potential fixes添加引用,二是检查AspNet5的安装。如果VS2015中仍出现问题,可能需重新安装AspNet5。本文记录了这些问题及其解决办法。
最低0.47元/天 解锁文章
5万+

被折叠的 条评论
为什么被折叠?



