Thursday, 17 February 2011

Making a Hybrid Web Application Project Type

Like so many of my blog entries, I've been meaning to write this one for weeks. Ever since Scott Hanselman wrote Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications, in fact. Scott just wrote an updated post on using NuGet to bring the MVC bits into a WebForms application, which is a muc easier way to do it. But to me, Scott's still missing the final piece of the puzzle which is: do this once, create it a project type from it, and forget about it.



So, creating a hybrid project type. First of all, go do Scott's NuGet stuff and create your hybrid application. Oh, and add any of your other favourite references - NHibernate, CastleWindsor, whatever. It's OK, I'll wait.
 
Done that. Good.
 
Now click File|Export Template... and open the Export Template Wizard. Check the 'Project Template' radio button so we export the hybrid project as a template. Click Next.
 
On the second screen, enter a suitable name for the project type and description, and choose an icon if you want.

Click Finish and you're done!