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 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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With