名称空间"Mvc"的类型在名称空间Microsoft.AspNet中不存在 [英] The type of namespace 'Mvc' Does not exist in the namespace Microsoft.AspNet'

查看:105
本文介绍了名称空间"Mvc"的类型在名称空间Microsoft.AspNet中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2015(最初在VS 2013中创建)中从事MVC项目

I am working on a MVC project in Visual Studio 2015 (originally created in VS 2013)

这一切都正确构建,但是在编码时,视图显示了很多错误.

It all builds correctly, but while coding, the views show alot of errors.

@{
 ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";

string quoteType = "Fee Estimate";
if (Model.Quote.QuoteType == "QuoteType")
{
}
}

在我其中一个视图顶部的代码中,Viewbag,Layout&所有带下划线的模型均显示错误.

In this code that is on the top of one of my views, the Viewbag, Layout & Model is all underlined showing an error.

错误是:

错误CS0103当前名称'模型'不存在 上下文Quilgroup C:\ ,,, \ Index.cshtml 268

Error CS0103 The name 'Model' does not exist in the current context Quilgroup C:\,,,\Index.cshtml 268

错误CS0234类型或名称空间名称'Mvc'在 命名空间"Microsoft.AspNet"(您是否缺少程序集 参考?)Quilgroup C:... \ Index.cshtml 1

Error CS0234 The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?) Quilgroup C:...\Index.cshtml 1

我认为开发环境有问题,因为它仍然可以正确编译并运行.

I think it is something wrong with the dev enviornment, because it still compiles and runs correctly.

推荐答案

删除%localappdata%\ Microsoft \ VisualStudio \ {version} \ ComponentModelCache文件夹,然后重新启动Visual Studio.

Delete %localappdata%\Microsoft\VisualStudio\{version}\ComponentModelCache folder then restart Visual Studio.

我遇到了同样的问题,并且解决了这个问题.

I had the same problem and this solved it.

来源: 查看全文

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