In working with Windows Azure, I’ve noticed that the v1.3 of the Azure tools only support ASP.NET MVC2. This makes sense, given that that version of the tooling was released before ASP.NET MVC3 RTM’d. But what if we want to deploy an MVC3 application to Azure? I had to hunt around the internet for some info on this, so I figured I’d make a simple walkthrough for those who need the visuals. Well it’s easy, but takes a few steps.
First, open up Visual Studio and create a blank solution for the project:
Next, add an ASP.NET MVC3 application to the solution:
Next, we need to make sure that the ASP.NET MVC3 Assembly is set up for a bin deployment, as Azure does not yet support MVC3 out of the box. To do this, we set the “Copy Local” property of the System.Web.MVC.dll to true:
Now, it’s time to add our Windows Azure project to the solution. Add another project to the solution, this time choose a “Windows Azure Project”:
You’ll now be asked what kind of Web or Worker Roles you’d like to add to the Azure project. You can feel free to add any Role you choose, but for this sample we’ll just hit OK with no Roles added:
Now we’re ready to add our MVC3 Project to our Azure project as a Web Role. Right click on Roles in the Azure project, mouse over Add and select “Web Role in Solution”:
Select your MVC3 Application and hit OK. It should be in the list of projects:
Now hit debug on the solution and Viola! MVC3 in the cloud! It should be noted that in order to debug Windows Azure applications, Visual Studio needs to be run at an elevated level.
It’s simple enough to do, and I’m sure the team in charge of the Azure tools for Visual Studio will fix this with the next release. Until then, enjoy ASP.NET MVC3. You can grab ASP.NET MVC3, the Windows Azure tools, and all sorts of other goodies using the Microsoft Web Platform Installer.
Questions? Comments? Feel free to hit me up on Twitter, or leave a comment here on the blog.
Until next time,