ASP.NET Web Application types not found

by Geert 17. June 2008 09:43

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

kick it on DotNetKicks.com

Fix for unknown types in ASP.NET Web Application projects

Tags:

ASP.NET | C#

Comments (3) -

Andrew
Andrew United Kingdom
6/30/2008 10:27:56 AM #

Your fix for the build action worked for me. Thanks a lot for posting the info.

Howie
Howie United States
8/29/2008 8:31:24 PM #

This post was Such a Great Help to me.
Thanks a ton!

Swati
Swati
5/26/2009 1:16:05 AM #

Also a thank-you for posting this.

Comments are closed

About the Author

Geert van Horrik is a independent freelance software developer since January 1st, 2007. Since then he was been working on several projects from C++ to C# (WPF, ASP.NET, etc). Currently he loves to write his software using WPF (or Silverlight if WPF isn't an option).

Lately, Geert is spending a lot of time on Catel, a free open-source MVVM Framework for WPF and Silverlight. Actually, it's more than "just" an MVVM Framework, it's a complete application library!