softwaremonster
softwaremonster

Reputation: 663

App_Code folder in ASP.NET project in VIsual Studio 2010

at vs2008 i could set App_Code folder, but at vs2010 i can not do it, that's why i put my dataset's and class' to App_Data folder. Either I do not know even App_Data folder is secure? Any suggestions?

Thanks

Upvotes: 4

Views: 22067

Answers (7)

MPaul
MPaul

Reputation: 2733

Workaround:

If we are using App_Code in a web application project, we need to rename into any other folder name.

http://blogs.msdn.com/b/chiranth/archive/2014/02/19/visual-studio-2012-unexpected-behavior-crash-and-irrelevant-errors.aspx

Upvotes: 0

Mike Cooper
Mike Cooper

Reputation: 21

If you want to use standalone class files (in "App_Code" dir) in VS 2010 project, be sure set the File Properties > Build Action for each *.cs or *.vb file to "Compile" in the Properties > Advanced dialog.

Also, use the same namespace as your project and these standalone classes will be readily available to the rest of your project.

Took me a bit to realize the default setting in my VS was "Content" instead of "Compile."

Upvotes: 2

ismail
ismail

Reputation: 41

If you want to add the App_Code folder, you have to manually add the folder. Add->Add New folder--> you have to give it the folder name "App_Code" when you do it, and vs2010 automatically will change its folder type.

good luck

Upvotes: 4

user593116
user593116

Reputation: 1

I hope this will help you - the .cs files should not be placed in a folder. Just put them in the project, alone, and not in a folder. Then your classes will be visible. This is a difference in VS 2010.

Upvotes: -2

JamesStuddart
JamesStuddart

Reputation: 2611

If you just create a folder called App_Code it will recognise it as the App_Code you want, it is strange that in the add .net folder it doesnt appear.

This the route I took for it, and it all works fine.

Upvotes: 0

abatishchev
abatishchev

Reputation: 100328

Remember, that Web Site Project can contain App_Code folder and Web Application Project can't! Because all project is for code.

Upvotes: 9

Quick Joe Smith
Quick Joe Smith

Reputation: 8232

Have you tried right-clicking on the project in the Solution Explorer, selected 'Add...' and looked under ASP.NET folders?

From memory, even previous versions of VS don't automatically put the App_Code folder in your project by default.

Upvotes: 1

Related Questions