Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 C# Web Project builds but IDE reports The type or namespace name xxx could not be found error

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.

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:

  • All Solution projects are configured to use the same Target Framework(.Net 4)
  • web.config in the Views folder contains the namespace in the system.web.webPages.razor section
  • cleaned and rebuilt solution
  • deleted all bin and obj content
  • deleted .suo and .csproj.user files that were created by VS2010

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

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

like image 897
simon co Avatar asked Dec 06 '13 10:12

simon co


People also ask

What version of C++ is in Visual Studio 2013?

Visual C++ 2013 (also known as Visual C++ 12.0) was released on October 17, 2013. It features further C++11 and C99 support, and introduces a REST SDK.

Is Visual Studio C free?

Visual Studio Community. A fully-featured, extensible, free IDE for creating modern applications for Android, iOS, Windows, as well as web applications and cloud services.

What is Microsoft C++ 2013 redistributable x64?

The Visual C++ Redistributable Packages install run-time components that are required to run applications that are developed by using Visual Studio 2013, on computers that don't have Visual Studio 2013 installed.

How to install Visual Studio Community 2013 on Windows 10?

Click on the following URL [ Visual Studio Community 2013] and you will be shown the following screen. Click on the Download button and an installer file will start downloading to your system. After the file is completely downloaded on your system, click on the file and run the setup.

Where to download Visual C++ redistribuibles for Visual Studio 2013?

Download Paquetes redistribuibles de Visual C++ para Visual Studio 2013 from Official Microsoft Download Center Dispositivos Surface Diseño original Comprar ahora Paquetes redistribuibles de Visual C++ para Visual Studio 2013

What's the difference between the Visual Studio 2013 and 2012 VC++ packages?

The Visual Studio 2013 VC++ Update 3.5 Redistributable Packages install run-time components that are required to run C++ applications that are built by using Visual Studio 2013. The Visual Studio 2012 VC++ Redistributable Update 4 Packages install runtime components that are required to run C++ applications built with Visual Studio 2012.

What's new in Visual Studio 2013 VC++ update 3 5?

The Visual Studio 2013 VC++ Update 3.5 Redistributable Packages install run-time components that are required to run C++ applications that are built by using Visual Studio 2013. Essential tools for building managed applications. Previously included in the .NET Framework, they are now available as this separate download.


3 Answers

I have the same issue.

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).

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.

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

like image 177
ALex Avatar answered Oct 19 '22 08:10

ALex


My solution, when I encountered the problem with VS 2013 Express edition was to simply unload the offending project and reload. Opening the SUO or Project file and making changes had not affect.

like image 42
Jim Taliadoros Avatar answered Oct 19 '22 07:10

Jim Taliadoros


Try to unload the project in VS2013, then right click the node and select edit "projectname.csproj". Check the individual references they might point to somewhere strange.

EDIT: the csproj file is an xml file and the references are located under Project -> ItemGroup -> Reference

like image 30
Simen Mossik Avatar answered Oct 19 '22 08:10

Simen Mossik