Single Project Add View in ASP.Net MVC 2 Preview 2

Single Project Add View in ASP.Net MVC 2 Preview 2

  • Comments 2

Last week we released ASP.Net MVC 2 Preview 2 for Visual Studio 2008 Sp1. In the box support for single project areas is now included and the Add View tool has been modified to streamline this scenario. A walkthrough that creates two simple single project areas can be found here. If you follow the steps in the walkthrough you will notice that Add Controller and Add View are now available in the single project areas in your ASP.Net MVC 2 Preview 2 application. Here are some screenshots that show off the tooling changes.

 

image

Right-Clicking the Controllers folder of any single project area (Areas –> Blog –> Controllers) will invoke the familiar Add Controller dialog.

 

image

The new controller will be added to the Controllers folder of the single project area rather than the Controllers folder of the ASP.Net MVC 2 Preview 2 Application.

 

image

Right-Click within an action method of the controller to add a view with the Add View dialog.

 

image

The view will be added to Areas –> [Area Name] –> Views –> [Controller Name] when added from an action method in the controllers folder of an area. The Views folder structure will be created for you if it does not yet exist. Notice the intellisense error in the view that was added. This is because the area needs a Web.Config just like the Web.Config in the Application’s Views folder. We are working on simplifying some of these scenarios for the next release of ASP.Net MVC 2 but for now you should follow the steps in the walkthrough to register your single project area so that it will work at run time.

 

image

Right click within the newly created area to find the familiar Go To Controller context menu item. The controller within your area also contains a Go To View context menu item. You can navigate back and forth between controllers and views in your area just as you can with controllers and views in the root of the ASP.Net MVC 2 application.

Hope this helps you get started with single project areas!

Joe Cartano | Visual Web Developer

Leave a Comment
  • Please add 5 and 7 and type the answer here:
  • Post
Page 1 of 1 (2 items)