MVC 4 and the App_Start folder

I've been delving into ASP.NET MVC 4 a little since its release last month. One thing I was chomping at the bit to explore was its bundling and minification functionality, for which I'd previously used Cassette, and been fairly happy with it. MVC 4's functionality seems very similar to Cassette's; the latter's CassetteConfiguration class matches the former's BundleConfig class, specified in a new directory called App_Start.

At first glance, this seems like another special ASP.NET folder, like App_Data, App_GlobalResources, App_LocalResources, and App_Browsers. But Visual Studio 2010's lack of knowledge about it (no Solution Explorer option to add the folder, nor a fancy icon for it) made me suspicious. I found the MVC 4 project template has five classes there--AuthConfig, BundleConfig, FilterConfig, RouteConfig, and WebApiConfig. Each of these is called explicitly in Global.asax's Application_Start method. Why create separate classes, each with a single static method? Maybe they anticipate a lot more code being added there for large applications, but for small ones, it seems like overkill. (And they seem hastily implemented--some declared as static and some not, in the base namespace instead of an App_Start/AppStart one.) Even for a large application I work on with a substantial amount of code in Global.asax.cs, a RouteConfig might be warranted, but the other classes would remain tiny.

More importantly, it appears App_Start has no special magic like the other folders--it's just convention. I found it first described in the MVC 3 timeframe by Microsoft architect David Ebbo, for the benefit of NuGet and WebActivator; apparently some packages will add their own classes to that directory as well. One of the first appears to be Ninject, as most mentions of that folder mention it, and there's not much information elsewhere about this new folder.


  • Came across your post and thought I'd point out a potential user. I'm integrating the use of AutoMapper into an MVC 4 application. App_Start is a perfect location to place the configuration class for it since it also is initialized from Global.asax file.

    Good article btw!

  • Hi Jake, and thanks for your compliment.

    Given that App_Start is there, your use sounds appropriate. My main points were that the project template's use of that directory (five nearly empty, inconsistently implemented classes), and giving it a "special" name following the App_* pattern when otherwise it doesn't share the other "special" directories' features, aren't ideal.


  • Hi Peter,
    Still trying to figure out if using a namespace such as Company.Website.App_start for classes in the app_start folder is necessary, or if PascalCode convention can be used? I ask this question base on the David Ebbo article and the use of NuGet etc. Should the name space matter to these applications or is it ust the folder name that matters?

  • What a poor choice of name, really confusing.

    Thx for sharing your research

Comments have been disabled for this content.