Porting legacy applications to ASP.NET 5

ASP.NET 5 (vNext) will be released with Visual Studio 2015.

Microsoft has embraced open source, and is sharing the development of ASP.NET 5 via GitHub – https://github.com/aspnet. This is a great decision on Microsoft’s part. It’s engaging for the development community, helping to build both knowledge, loyalty, and momentum for the product. It also provides Microsoft with a huge resource of mostly valuable professionals – MVP pun intended – helping test and drive improvements to the features. When the product does finally come to market there will already be a wealth of knowledge and articles on the web ready to go.

Currently at version CTP 6, Visual Studio 2015 and ASP.NET 5 are looking pretty solid so far. Microsoft hasn’t given a specific release date, But my guess is some time in Q3.

I must admit to being quite excited about the new features – I know, I need to get out more. And I look forward to using them in anger. But obviously it would not be wise to commit to upgrading to Visual Studio 2015 and ASP.NET 5, in a production environment, until product development is complete and there is a stable release available. This may be release 1 or possibly SP1 depending on your risk propensity.

You would have to be sure that legacy solutions, built on earlier versions of .NET and Visual Studio, could be easily ported into Visual Studio 2015. OK, you can run versions of .NET and Visual Studio side-by-side in a development environment. But how many versions do you want cluttering up your development servers? Best to have only 1 version, particularly when provisioning new development servers, and when recruiting and training new developers.

Well, the word from Microsoft with regard to porting across legacy applications to Visual Studio 2015 is as follows –

http://www.asp.net/vnext/overview/aspnet-vnext/aspnet-5-overview#legacy

You may be worried that, with the number of changes in ASP.NET 5, you now need to re-write all of your applications. Don’t worry. Applications that you built on earlier versions of ASP.NET will continue to work with the new .NET Framework. You do not need to update or port these applications if you do not need the new features in ASP.NET 5.

Great news if it works. But of course the proof of the pudding is in the eating. I thought I would try it out.

My pet BikeStore solution is comprised of an MVC 5 web application, a number of class libraries, a unit test project, and a WCF service application. So a variety of project types.

Here’s the project in VS 2013, with the web application’s properties displayed –

VS2013

And the project opens in VS 2015 CTP 6, without needing any intervention at all –

VS2015

And yes, I did do a double check as the IDE, and properties windows are almost identical. The second image is definitely 2015.

I am able to compile and run the web application, run the tests, and debug the WCF service classes using the WCF test client.

In comparison, if I create a new ASP.NET 5 Preview application, this is what I get for the project properties –

vNext

It’s very much simplified due in part to some of the new ASP.NET 5 features. And this is a key point. Yes, it looks like we can easily port legacy applications to VS 2015 – although maybe there will be issues with very early versions of .NET and VS. The legacy environment and features are pretty much replicated. But what about the new ASP.NET 5 features? There’s a lot of great stuff, such as the cross-platform runtime, simplified dependency management, and some cracking improvement to MVC. I suspect that to use this features with a legacy application, the solution will need to be built from the ground up, starting with new projects, and then adding the existing classes and dependencies. Whether all the existing functionality will work with the new CLR and new version of MVC – your guess is as good as mine. I will be finding out though as I’m going to be “Re-writing” my BikeStore application to use the new features. I will share my experiences in future blog posts.

Bottom line is that ASP.NET 5 is significantly different from earlier versions.

If you have a legacy application that you are maintaining and will require incremental changes going forward, then by all means open and maintain the solution using VS 2015 – when a stable version is available.

If you are planning on a major change to an existing legacy application, and thus will be making significant modifications and extensions, then it may be worthwhile fully migrating to ASP.NET 5 by starting with a new ASP.NET 5 solution. This will future proof the application, and will make the developers very happy – and happy developers are good developers 😉

 

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s