Azure + Silverlight 4 + RIA Services + MVC2 (Part 1)
Posted on February 19, 2010
by Peter Daukintis
The original idea for this post was to see whether this combination of technologies played well together. Whilst the development tools seem to support this scenario I believe that there is, as yet, no support for .NET 4 on Azure (see When .NET 4.0 will be available in Azure ?), so some of this discussion is hypothetical. The first post outlines setting up the development environment.
Anyway, first I began by doing what seemed obvious:
Having installed the required SDKs and tools for SL4, RIA services and Azure I started VS2010 (Beta 2) and created a new Windows Azure Cloud Service project, chose to add an MVC 2 Web Role by right-clicking on the Web Role folder of the newly created cloud project, added default unit test project and tried running this and it all ran fine.
Then, I added a Silverlight 4 project to be hosted in the MVC app. I did this by adding a new project to the solution, choosing Silverlight Navigation Application Project. From the options presented I chose to host the new app in the existing MVC app and I then set the aspx page which was added to the MVC project as the start-up page. Hit F5 and the build system produces this error
Error 2 Cloud Service projects currently support Roles that run on .NET Framework version 3.5. Please set the Target Framework property in the project settings for this Role to .NET Framework 3.5.
So, I can’t get my app running in the Azure Development Fabric due to my dependencies on .NET 4 (I was hoping that the development tools may support this scenario).
I decided to prepare the app for when this would be possible and so turned my attention towards RIA Services. It was at this stage that I realised that what I wanted to actually do was to create a Silverlight Business Application rather than a navigation application. This VS template is available when you install the RIA Services Beta. However, I had previously experimented with RIA Services using VS2008 and the corresponding RIA Services installs do not live together (at least, according to the installer as it insists that you remove any previous versions). So, backing up a little bit, I uninstalled the VS2008 version and re-installed for 2010. I then ran through the above procedure again but chose the Business Application template rather than the navigation one.
Having worked through the steps again, the result was very similar except for the addition login control:
So, hopefully I am now where I wanted to be, which was to have a solution that can be hosted easily in the cloud (when Azure supports .NET 4) with a development environment in which I can carry out some rapid, test-driven development.