Cannot add App_Code folder to WebSite project

JohnIdol picture JohnIdol · Feb 22, 2009 · Viewed 12.6k times · Source

Using VS2008, I am trying to add an App_Code folder from add-->folder-->Add ASP_NET folder.

The App_Code folder option is there as expected BUT ... it's disabled!?

I am pretty sure I am working with a WebSite project (and not a Web Application) because I can add all the other ASP_NET folders (App_Data - App_themes etc) and also because I don't have the controls declarations in my-code behind (as opposed to Web Application where you have partial classes with controls declaration and eventHandlers etc.). Fact is, if it's not a website project how come I can add the other ASP_NET folders? And also - why I am not getting any designer file with controls declaration etc? This is the way things used to work in VS2005.

If I go ahead and add App_Code folder myself as a normal folder it picks-up the icon of the ASP_NET App_Code folder - so it seems to be working fine.

Still it's bugging me 'cause I can't understand why the opion is disabled in the first place.

Any clue why this is happening?

EDIT: I am trying to create a new web site and I get only the web application template so I doubt I was able to create a website in the first place. A bit confused here!

Answer

Iain M Norman picture Iain M Norman · Feb 22, 2009

No idea why it's happening, but you should be able to just add a new folder in the Solution Explorer and rename/call it App_Code.

Do this in Windows Explorer even, if you like.

Refresh and it'll pick it up.