的Visual Studio 2013 C#Web项目建立,但IDE报告类型或命名空间名称XXX找不到错误 [英] Visual Studio 2013 C# Web Project builds but IDE reports The type or namespace name xxx could not be found error

查看:372
本文介绍了的Visual Studio 2013 C#Web项目建立,但IDE报告类型或命名空间名称XXX找不到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在Visual Studio 2013打开一个MVC4 C#的web项目时,IDE报告错误类型或命名空间名称'的 _ 的'找不到(是否缺少using指令或程序集参考),但该项目建立并没有任何错误运行。此外,智能感知不包括项目名称空间。

When opening an MVC4 C# web project in Visual Studio 2013, the IDE reports the error "The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference)", but the project builds and runs without any errors. Furthermore, intellisense does not include the project namespace.

丢失引用的是同一个项目中的文件。
例如; Web项目命名空间是webproject.com,并在控制器文件中提及webproject.com.models的红色下划线上述错误。

The "missing" reference is to files within the same project. for example; the web project namespace is "webproject.com", and references in a controller files to "webproject.com.models" is underlined in red with the error above.

我已经检查了以下内容:

I have checked the following:


  • 所有解决方案项目被配置为使用相同的目标框架(.NET 4)

  • 的web.config中的浏览文件夹包含在system.web.webPages.razor部分命名空间

  • 清理和重建的解决方案

  • 删除了所有bin和OBJ含量

  • 删除了VS2010中创建和名为.suo文件.csproj.user

这是我可以摆脱这些错误在VS2013被报道的唯一方法是卸载然后重新加载该项目。

The only way that I can get rid of these errors being reported in VS2013 is to unload then reload the project.

在Visual Studio 2010中打开我不明白这些问题。

When opened in Visual Studio 2010 I do not get these problems.

推荐答案

我有同样的问题。

虽然该项目正确编译时,code编辑器显示错误类型或命名空间名称'_'找不到(是否缺少using指令或程序集引用)。

ALthough the project compiles correctly, the code editor shows an error The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference).

有一个解决方法。只是删除名为.suo *文件,然后重新打开该解决方案。那么这只会话它的作品。不幸的是后关闭并重新打开该解决方案的问题又回来了。 VS 2012的罚款。

THere is one workaround. Just delete the *.SUO files and re-open the solution. THen for this only Session it works. Unfortunately after closing and reopening the solution the issue is back again. VS 2012 works fine.

似乎是在VS 2013中的错误....

Seems to be a bug in VS 2013....

这篇关于的Visual Studio 2013 C#Web项目建立,但IDE报告类型或命名空间名称XXX找不到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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