Why does ASP.NET MVC have to be a ‘web application’?

Recently I’ve been doing some presentations at user groups about ASP.NET MVC . A couple of times the question has been asked “Why does ASP.NET MVC have to be a ‘web application’?” Not having a really good understanding of why, I decided to ask the StackOverflow and ASP.NET Forums communities. I couple of people had some great theories, but I still had no definitive answer as to why. So, I decided to put the question to Scott Guthrie, I thought if anyone will know this he will. And Scott’s answer, well, it doesn’t have to be a web application. Here’s his response:

Hi Peter,

With ASP.NET MVC projects the view files (.aspx, .ascx, .master) still compile separately (they are copied as source onto the server and dynamically compiled at runtime like a web-site project). The classes within the project (controllers, models, helpers, etc) do compile into a single project-level assembly.

ASP.NET MVC itself doesn’t require the application project to be a web application project (it works with web-site projects too), but we decided to have it go with web application projects by default to to enable better unit testing. By having them be a referenceable assembly a unit test project can reference the application and easily author unit tests against it.

Note that Visual Web Developer Express SP1 now supports web application projects – so these are available to all users (and not just the paid products).

Thanks, Scott

Thank you Scott for clearing that up!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s