Namespace not found within the same project according to intellisense, yet project builds

折月煮酒 提交于 2020-01-02 04:35:10

问题


I have a simple ASP.Net MVC project which for some reason has issues with intellisense. It is constantly giving me errors that namespaces local to the project can not be found, even though they do exist and the project will build fine. Here's an example:

It is very frustrating as this results in me having no intellisense available whatsoever. Has any one encountered a problem like this before, and do they know of a solution?

The project itself is an MVC4 website running in VS2013 in W8 under Paralells on a Macbook Air, should that have any effect on the problem.

As stated, I have no error messages to provide as the project builds and runs successfully, but please let me know if more details are required.


回答1:


I had the same issue. Try removing your project from the solution and then add it again. It worked for me. Looks like a solution file quirk.

UPDATE: this is not a permanent fix as closing and reopening visual studio brings back the issue.

UPDATE 2: while looking to fix another issue where I couldn't change the default namespace of a project (I would get a System.Runtime.InteropServices.ExternalException), I found out that it was related to Xamarin tools for Visual Studio. I proceeded to completely uninstall Xamarin. It fixed my namespace renaming issue as well as the weird type or namespace not found / intellisense issue.




回答2:


I had this same issue, seems to be something with the solution file and building the project as I could replicate the problem by simply creating a new project building then restarting visual studio.

Anyway I get around it at the moment by deleting the solution file and opening the project using the project file.



来源:https://stackoverflow.com/questions/20690470/namespace-not-found-within-the-same-project-according-to-intellisense-yet-proje

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!