views:

4122

answers:

5

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!

A: 

May be if you add .cs file, it will be created?

Did this option worked for you before? Did you do something before it stopped working?

Alex Reitbort
I just installed VS2008 - so it's the first time I try - even if I add .cs files it's still disabled
JohnIdol
+1  A: 

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.

Iain M Norman
I did that and it picked it up - but why is it disabled in the first place?
JohnIdol
My first thought was you were debugging. But that appears to disable the whole menu when I tested it.
Iain M Norman
+2  A: 

Are you sure it is web site project and not web application?

Alex Reitbort
see edit in the OP about this
JohnIdol
Wait - 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.
JohnIdol
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?
JohnIdol
I established it's a web application!
JohnIdol
+1  A: 

There's really no such thing as a "web site project". Web sites are project-less, in that they don't contain a .csproj (or .vbproj) file in the folder. If you see this file, then it's a "web application" project. Also, if you're selecting from the menu "new project...", then you're not selecting a "web site".

The only way that you're using a web site, is by selecting "new web site" from the VS File menu.

Robert
A: 

You add a new folder to project. Then, rename it as App_Code. Visual studio could revise the folder as App_Code folder.