Problem with classes under App_Code folder in VS 2008

We are developing a new ASP.NET web application in Visual studio 2008. Last week we’ve decided to use HttpHandlers instead of some web pages. And as we used to do in Visual Studio 2005 web sites created an App_code folder after that we created new classes under that folder.

Then we noticed that there is intellisense problem with these files. Also we noticed that there is a namespace problem with these classes.

When you add new class to app_code folder VS2008 names the class like this: RootNameSpace.App_Code.Class1. But object browser doesn’t include any definition about App_Code namespace and sub classes.

figure 1: No namespace for ICFWeb.App_Code

 Then I decided to check the properties of the classes. Right clicked a class under the App_code folder. And select its properties.

figure 2: No intellisense and color highlighting for editor.

When we looked at the properties. We saw build action for class is set to “Content”. Problems are fixed after i changed that property to “Compile”  

figure 3: Change build action from “Content” to “Compile”

After i searched the google for source of the problem. Problem is the app_code folder is for the web sites. There is no use of that folder for the web applications. Also app_code folder is not included in the “Add ASP.NET Folder” context menu of the solution explorer when you want to add App_code folder to your web application project.

Happy coding… 

Posts created 141

Leave a Reply

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top