CS0234The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you
来源:互联网 发布:姬存希 知乎 编辑:程序博客网 时间:2024/06/05 10:11
CS0234The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
CS0246The 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(显示可能的/可用的修复方法),如下图:
然后我觉得Core包比较像,点击它,就会添加这个包的引用,添加完成之后,你会发现Mvc下面的红色波浪线消失了;
其实你也可以在解决方案管理器(Solution Explorer)中添加引用来解决这个问题,但我觉得还是这样操作方便快捷一些;如下图:
解决方案二:
此方案用于另一种情况,操作系统:Windows 7 x64
安装文件:AspNet5.ENU.RC1_Update1_KB3137909.exe
安装过程中提示需要:Microsoft .NET Framework 4.5.1,
我就没有再安装AspNet5,而是开始安装VS 2015,
参考:《ASP.NET5》Windows 7下Visual Studio 2015安装记录
安装完VS 2015,打开一个现有的项目,添加一个 Web API Controller Class,就会现在该问题;
可能是之前的AspNet5没有安装完全,导致按上面的方法也不能解决,
点击 Show potential fixes(显示可能的/可用的修复方法)也不会提示出正确的修改方法,
需要重新安装AspNet5,参考:AspNet5.ENU.RC1安装错误:0x80072f0d - 未指定的错误
小结
从Asp.Net5的版本发布时间表来看,今年一季度才发布第一个正式版,
与小伙伴们接触的时间还比较短,以至于很多问题在网上都不容易搜索到解决方案。
我这里做个记录,希望对大家有帮助;
=============================分隔线===================================
有些东西,并不是越浓越好,要恰到好处。深深的话我们浅浅地说,长长的路我们慢慢地走。——毕淑敏
- CS0234The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you
- Error:The type or namespace name 'Office' does not exist in the namespace 'Microsoft' 解决方法
- The type or namespace name 'Windows' does not exist in the class or namespace 'System'
- 解决The type or namespace name \'XXXX\' does not exist in the namespace \'XXXXXXXXX\' 的错误
- The type or namespace name 'Zhaopin' does not exist in the namespace 'LMSoft' 问题的解决
- CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data'
- Unity3d——报错 The type or namespace name `Ports' does not exist in the namespace `System.IO'
- The type or namespace name 'Service' does not exist 异常处理
- UI' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference
- The name “LayoutAwarePage” does not exist in the namespace
- The type or namespace name `MovieTexture' could not be found. Are you missing an assembly reference?
- The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an asse
- The type or namespace name '***' could not be found (are you missing a using directive or an asse
- The type or namespace name 'AjaxControlToolkit' could not be found in the global namespace
- Error: ‘shared_ptr’ in namespace ‘std’ does not name a type
- Error 6 The tag 'CrystalReportsViewer' does not exist in XML namespace 'clr
- 由“error string in namespace std does not name a type”错误引发
- error: 'function' in namespace 'std' does not name a template type
- JAVA 一个简单的图形界面计算器
- 3910: 火车 LCA+并查集
- Activity的生命周期(三)——结合Activity的生命周期理解子类继承父类预加载数据
- Boost MPI send and recv
- 获取UIWebView的高度
- CS0234The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you
- 详解配置java环境变量那点事儿
- 第52课:Hadoop链式MapReduce编程实战
- 心路
- 【年度总结】——踏雪留痕
- 使用批处理清理vs工程项目
- 3207: 花神的嘲讽计划Ⅰ 主席树+hash
- 番茄助手破解问题
- 半年总结—沉淀就是力量