Using App_Code Folder in VS 2008 .Net 3.5 Projects.

I’ve discovered that adding classes to a folder called App_Code in VS 2008 may not be such a good idea. I usually create folders for a Business Logic Layer (BLL) and Data Access Layer (DAL) to manage connections to a database. Recently, well, since I’ve started using Visual Studio 2008, I’ve had to find ways round using them because I was having issues.

The first issue is when creating a class in the App_Code folder, it can’t access the System.Data namespace – even though the Data namespace is added as a reference. Seems strange, as I’ve always managed it before (even in the 2008 Express range of products).

When I hard-code a solution to the above issue, the project either will not compile or produces errors when it runs.

The solution I’ve found is to create a new folder in the root, and place the class in there. The name of the folder should be something other than App_Code. Hopefully it should compile and run as normal then.

I got the solution from here.