Sunday, February 17, 2008

Tooling Features Overview of ASP.NET MVC Framework for MIX 2008

There has been a tremendous positive response on ASP.NET MVC Framework from the community since we released the December 2007 CTP of ASP.NET Extensions.  With MIX 2008 coming closer our teams have been super busy in trying to bring out value additions to ASP.NET MVC Framework.  ScottGu, in his ASP.NET MVC Road-map post, recently introduced the new MVC features coming up with MIX preview.  He had mentioned that with this MIX release ASP.NET MVC will get much better Visual Studio 2008 integration and support.  My post today is to outline these integration points and support within Visual Studio.

Features:  During December 2007 preview of MVC we just had project templates to support MVC development within Visual Studio, since then there have been some improvements which are as below:

Project Template Filtering and Naming: MVC Project templates will now be filtered based on .NET Framework version and will be available only when you select Framework version 3.5.  You can now also name your projects and solutions as per your choice which was not possible in the Dec 2007 CTP.

Test Framework Options: In Dec 2007 CTP we had 'MVC Application' project template and also had 'MVC Application and Test' project template.  We now do not expose the 'MVC Application and Test' project template instead we have a cool new Test Framework options dialog which shows up as soon as you click okay on you MVC Application creation.  This test framework dialog assumes that you want to create your test project in the same language as your primary MVC Application and so it does not show you that option.  TheTest Framework dialog box will look like below:

image

When you select your Test framework and click okay Visual Studio will create a multi-Project template with the Test Project already having reference to your primary MVC Application.  In my follow up post on this topic will learn about the way 'Test Framework Options' dialog box works behind the scenes and understand the way by which we can extend it to use external 3rd party testing frameworks.

'Add New Items' Dialog Box:   The new 'Add New Item' dialog box for MVC Applications will show a "MVC" node under the "Web" node as shown below.  This will allow you to locate your MVC item templates pretty easily:

image

ASP.NET MVC framework (without any extensibility customizations) requires you to suffix your controller names with "Controller".  Visual Studio will now help you achieve this mundane task by reminding you about it and 'by default' naming it correctly in your project.

Making Routes more Testable:    We have also gone ahead and changed global.asax to make your routes much more testable by default.  The new global.asax will look something similar to below:

image

You can very easily now call RegisterRoutes externally to test your routes.

Getting Designer.cs/.vb Files Back:  In December 2007 CTP our view pages did not have the .designer.vb and .designer.cs files attached to them, many of you asked us to get that in so that server control useage would become easier.  In the MIX 2008 CTP every View Page, Master Page and Content Page associated with MVC development will come with a pre-created designer.cs/vb file.

image

Debugging Settings:   We have now made some default debugging settings so that your MVC application will debug no matter where you hit F5 in your solution explorer.  You will definitely have option to modify this behavior in the property pages of your MVC Application.

Removing 'View in Browser' & 'Add a Content Page' Commands:  If you right click on .aspx pages within an MVC Application you will not see 'View in Browser' command.  This command has been intentionally disabled as in case of MVC application we want that the calls made are not handled directly to .aspx pages but rather get routed via a controller, which in turn will produce ViewData and redirect to the right View Page.  "Add a content Page' command was also removed from Master Pages in MVC application as creation of View Pages is expected to be location specific depending on the controller and 'Add a Content Page' was not directly applicable in such scenarios.

New Look And Feel:  MVC Application right off the shelf will now also have a much more CSS friendly  and pretty UI which you can start customizing and converting into your real world application.  I am attaching a screenshot of how ASP.NET MVC Application will possibly look like as soon as you hit F5 on this new template.

image

Hope these features help you with using ASP.NET MVC Framework.  In follow up posts on the ASP.NET MVC topic, I will write back about customization of Test Framework dialog box.  In the meantime hope this gets you up to speed with our efforts around ASP.NET MVC Framework.

4 comments:

Anonymous said...

First, thanks for integrating the MVC framework into VS2008.

I have a request, please bring back the "View in browser" feature. Not for the .aspx files, but for the project files.

I like to have the site running in IE while developing, updates can be reviewed faster.

Now I have to start the website in debug mode... it is a bit tedious.

Is this possible?

And lastly, thanks again for the great work.
Mikkel Ovesen
http://www.ovesens.net

Vishal R Joshi said...

Thanks for the great suggestion... We will try to revive the "View in Browser" functionality for other project types...

Anonymous said...

You should bring back the "Browse with..." command in the right click menu, since it's the only way (that I know of) to change the default browser in Visual Studio. Last time I wanted to do that, I had to create a new webforms project just to right click an .aspx file to get that option!

Ravi said...

"Browse with" is one of the option, when you right click the Default.aspx. Even, I was looking for this option by right clicking the MVC project. My teammate helped me to find this.