Unable to add App_Code folder to WebSite project

Using VS2008, I am trying to add the App_Code folder from the add → folder → Add ASP_NET folder.

The App_Code folder option exists as expected, but ... is it disabled !?

I am sure that I am working with a WebSite project (and not with a web application) because I can add all other ASP_NET folders (App_Data - App_themes, etc.), and also because I do not have control declarations in my- (unlike a web application where you have partial classes declaring controls and eventHandlers, etc.). Fact is, if this is not a website project, why can I add other ASP_NET folders? And also - why am I not getting any designer file with management declaration, etc.? This is how everything works in VS2005.

If I continue and add the App_Code folder myself as a regular folder, it will pick up the ASP_NET App_Code folder icon - so this works fine.

He still pushes me, because I can’t understand why the option is disabled in the first place.

What is the clue why this is happening?

EDIT . I am trying to create a new website and I only get the web application template, so I doubt that I was able to create the website in the first place. A bit confusing!

+4
source share
7 answers

Are you sure this is a website project, not a web application?

+3
source

I don’t know why this is happening, but you just have to add a new folder to Solution Explorer and rename / call it App_Code.

Do it in Windows Explorer if you want.

Refresh and he will pick it up.

+5
source

You add a new folder for the project. Then rename it as App_Code. Visual studio can review the folder as the App_Code folder.

+2
source

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

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

0
source

Actually there is no such thing as a “website design”. Websites are project independent because they do not contain a .csproj (or .vbproj) file in the folder. If you see this file, then this is a "web application" project. In addition, if you select "new project ..." from the menu, then you do not select "website".

The only way you use the website is to select "new website" from the "File VS" menu.

0
source

You can go to the new App_Code folder option in the “New ASP.Net” folder if you are working on a website and not a web application. Caught me a few times. Hope this helps.

0
source

you cannot add the App_Code folder to the web application because this folder is for compiling asp.net runtime, and the web application project is for you to precompile your website in dll, which you can find in Bin folder and deployment on your site.

So, for web application projects, you should instead add a folder called "CodeFolder" and then add a class there. Then right-click the properties of this class file and set the assembly configuration to compile, not the contents.

-1
source

All Articles