Geeks With Blogs

News Opinions and articles on this blog are mine alone and do not represent my employer. All articles and blog entries are posted using a personal computer system outside of my employer network.
Sam Abraham Software Engineer/Architect: Putting Customers First
With MVC2 officially released, I was involved in a few conversations regarding the feasibility of upgrading existing MVC 1.0 projects to quickly leverage the newly introduced MVC features.
Luckily, Microsoft has proactively addressed this question for both Visual Studio 2008 and 2010 and many online resources discussing the upgrade process are a "Bing/Google Search" away.
As I will happen to be speaking about MVC2 and Visual Studio 2010 at the Ft Lauderdale ArcSig .Net User Group Meeting on April 20th 2010 (Check http://www.fladotnet.com for more info.), I decided to include a quick demo on upgrading the NerdDinner project (which I consider the "Hello MVC World" project) from MVC 1.0 to MVC2 using Visual studio 2010 to demonstrate how simple the upgrade process is.
In the next few lines, I will be briefly touching on upgrading to MVC2 for Visual Studio 2008 then discussing, in more detail, the upgrade process using Visual Studio 2010 while highlighting the advantage of its multi-targeting support.
Using Visual Studio 2008 SP1
For upgrading to MVC2 Using VS2008 SP1, a Microsoft White Paper [1] presents two approaches:  1- Using a provided automated upgrade tool, 2-Manually upgrading the project.
I personally prefer using the automated tool although it comes with an "AS IS" disclaimer. For those brave souls, or those who end up with no luck using the tool, detailed manual upgrade steps are also provided as a second option. Backing up the project in question is a must regardless of which route one would take to upgrade.
Using Visual Studio 2010
Life is much easier for developers who already adopted Visual Studio 2010. Simply opening the MVC 1.0 solution file brings up the upgrade wizard as shown in figures 1, 2, 3 and 4. As we proceed with the upgrade process, the wizard requests confirmation on whether we choose to upgrade our target framework version to .Net 4.0 or keep the existing .Net 3.5 (Figure 5). VS2010 does a good job with multi-targeting where we can still develop .Net 3.5 applications while leveraging all the new bells and whistles that VS2010 brings to the table (Multi-targeting enables us to develop with as early as .Net 2.0 in VS2010)
Open Solution file in VS2010
Figure 1 - Open Solution File Using VS2010
 
VS2010 Conversion Wizard
Figure 2 - VS2010 Conversion Wizard
Reading To Convert Solution to VS2010
Figure 3- Ready To Convert To VS2010 Confirmation Screen
Figure 4 - VS2010 Solution Conversion Progress
Confirm Target Framework Upgrade
Figure 5 - Confirm Target Framework Upgrade
In an attempt to make my demonstration realistic, I decided to opt to keep the project targeted to the .Net 3.5 Framework.  After the successful completion of the conversion process,  a quick sanity check revealed that the NerdDinner project is still targeted to the .Net 3.5 framework as shown in figure 6. Inspecting the Web.Config revealed that the MVC DLL version our code compiles against has been successfully upgraded to 2.0 (Figure 7) and hence we should now be able to leverage the newly introduced features in MVC2 and VS2010 with no effort or time invested on modifying existing code.
Figure 6- Confirm Target Framework Remained .Net 3.5
 Figure 7 - Confirm MVC DLL Version Has Been Upgraded
In Conclusion, Microsoft has empowered developers with the tools necessary to quickly and seamlessly upgrade their MVC solutions to the newly released MVC2. The multi-targeting feature in Visual Studio 2010 enables us to adopt this latest and greatest development tool while supporting development in as early as .Net 2.0.
References
1. "Upgrading an ASP.NET MVC 1.0 Application to ASP.NET MVC 2"
Posted on Sunday, April 18, 2010 1:28 PM Fladotnet.com , Tech Talk , VS2010 , MVC2 | Back to top


Comments on this post: Upgrading from MVC 1.0 to MVC2 in Visual Studio 2010 and VS2008.

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Sam Abraham | Powered by: GeeksWithBlogs.net