Thursday, May 27, 2010

Updating Visual Studio 2008/.NET 3.5 RIA Services applications to Visual Studio 2010

With multi-targeting, upgrading to new versions of Visual Studio should be painless right? Not so if you’re using Ria Services.

My God, what have we done?

We’ve recently built a few Silverlight 3 applications using Visual Studio 2008, .NET 3.5 and WCF Ria Services.  These applications are fairly small sample applications built on top of and inside of our existing.NET 3.5 business applications, a fairly large multi-project Visual Studio solution.  Now that it’s time to upgrade that solution to Visual Studio 2010, we’ve found some difficulties with WCF Ria Services. 

Oh Yeah

We plan to upgrade the Visual Studio tool first and later begin a migration plan to move our projects from .NET 3.5 to 4.0.  A fairly straightforward and mainstream approach. What we’ve found right off the bat, however, is that Visual Studio 2010 doesn’t support the WCF Ria Services Beta that we used with Visual Studio 2008, in fact those projects won’t even compile with 2010.  You’ll likely get a goofy message like:

Warning 29 The primary reference "System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has a higher version "" than exists in the current target framework. The version found in the current target framework is "". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1360 9 SPE.Web.Common

To get around this we can upgrade to WCF Ria Services v1, for Visual Studio 2010, which is all well and good, except that it requires Silverlight 4 and .NET 4.0.

So let it be written; so let it be undone

The Silverlight 4 requirement is a non-issue; they’re just sample applications with no particular dependency on Silverlight 3, but requiring the Domain Services on the server-side to be .NET 4.0 is another story.  This would have a cascade effect forcing a complete migration to 4.0 just to get WCF Ria applications to work.  We could clearly restructure some of the dependencies and limit the 4.0 upgrade to just the web application hosting Silverlight, but even that seems excessive.  The obvious choice for us is to remove the Silverlight applications for now, upgrade to Visual Studio 2010 and then revisit the Silverlight applications during the .NET 4.0 migration.  Thankfully we hadn’t gotten too far with Silverlight and WCF Ria Services, so removing those applications isn’t too onerous. 

Based on this experience I’d recommend to anyone considering WCF Ria Services, only do so on .NET 4.0.  I guess that’s what I get for using a Beta product.