在APP_ code目录默认生成操作? [英] Default Build Action in App_Code directory?

查看:753
本文介绍了在APP_ code目录默认生成操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我在MVC 3 Web应用程序的任何位置添加一个新类我APP_ code目录下,它被设置为内容的生成操作。我需要将其设置为默认编译。有没有什么地方在Visual Studio中设置code默认生成操作这个目录下?

Every time I add a new class anywhere underneath my App_Code directory in my MVC 3 web application, it gets set with a Build Action of "Content". I need to set it to "Compile" by default. Is there somewhere in Visual Studio to set a default build action for code underneath this directory?

推荐答案

MVC项目不是网站项目,它们是Web应用程序项目。网站项目(除非pre-编译)部署与源$ C ​​$ c和由ASP.NET运行时动态编译。 Web应用程序项目构建和部署为独立的阶段。 APP_ code是从应用程序的其余部分单独编译一个特殊的ASP.NET文件夹。这就是为什么在APP_ code默认为内容的项目,这样他们就可以进行部署(源)分别申请(其中被编译)。

MVC projects aren't Website projects, they are Web Application projects. Website projects (unless pre-compiled) are deployed with source code, and are dynamically compiled by the ASP.NET runtime. Web Application projects are built and deployed as separate stages. App_Code is a special ASP.NET folder which is compiled separately from the rest of the application. This is why the items in App_Code default to Content, so they can be deployed (source) separately of the application (which gets compiled).

在Web应用程序项目,你不为你的项目布局,其所有编译code。在一天结束的任何标准格式的制约。我建议要么使用模式文件夹中的项目,或者只是创建自己的,我不会用APP_ code。

In Web Application projects, you're not governed by any standard format for your project layout, its all compiled code at the end of the day. I'd recommend either using the Models folder in the project, or just creating your own, I wouldn't use App_Code.

这篇关于在APP_ code目录默认生成操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆