开发者

Where to save classes of the web-application

开发者 https://www.devze.com 2023-02-01 06:20 出处:网络
I have to create a small asp.net-application. The last such web-application I have built was a while ago. At this time, I have saved my classes in the App_Code-folder.

I have to create a small asp.net-application. The last such web-application I have built was a while ago. At this time, I have saved my classes in the App_Code-folder.

During setting up the web-solution in VS2010, I have seen that VS does no more propose to create the app_code directory (right click on the project, Add asp.net-folder). Is the App_Code folder no more the prefered location to save classes of the web-application and where is the new place to store them?

Update

Thanks to Oded I have received the answer to my question.

If one has the same question as I had, probably he is also not aware (as I was), that there are two different types of projects with their own menu-points in VS: Web-Ap开发者_高级运维plication and Web-Site. The organisation of these two types is different. For a web-application, the app_code-folder is not proposed in the asp.net-folder-menu . Maybe this information helps someone.


It is the preferred place, but VS 2010 just doesn't automatically create it for you any more.

As you can see from the documentation of app_code for .NET 4.0, it is still the best place for shared code.

In a Web site project, you can store source code in the App_Code folder, and it will be automatically compiled at run time. The resulting assembly is accessible to any other code in the Web application.

0

精彩评论

暂无评论...
验证码 换一张
取 消