ASP.NET Web Application types not found

Introduction 
When I was converting a Web site to a ASP.NET Web Application project in Visual Studio 2008, all my classes in the App_Code folder were not recognized any longer.

After some small investigation, it seemed that App_Code cannot be used in an ASP.NET Web Application project in Visual Studio (2005/2008). So, I put all the classes, before located in App_Code, to subfolders of the project and added the corresponding namespaces.

Problem
However, I was still getting the following compile error:

Error 129 The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

After googling for this problem, I still couldn't find the problem. Then I thought: wait, are the classes even being compiled? No, the classes were actually not compiled. Somehow, the classes were set as content.

Fix
Select the file that is not being compiled in the solution explorer and view its properties (hit F4). Make sure the Build Action is set to Compile, and not to Content (which was the case with my project).

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5