Running .NET 4.5 on Azure

I have a project I am working on for the client that targets Azure.  I wanted to move up to .NET 4.5 to take advantage on async/await keywords and other improvements.  It is a an MVC 4 project.  Of course in order to run .NET 4.5 on Azure, you have to update your project configuration.  You have to set osFamily attribute, described in details here.

Unfortunately, this attribute is not exposed in project properties, so you have to resort to Visual Notepad to make the change.  Simply open the Azure service definition (ServiceConfiguration.Cloud.cscfg) in your text editor, then change the attribute osFamily to 3.  This family is similar to Windows Server 2012, which ships with .NET 4.5

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="MyAzureService" 
xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" 
osFamily="3" osVersion="*" schemaVersion="2012-10.1.8">
  <Role name="WebRole">
    <Instances count="1" />
  </Role>
</ServiceConfiguration>

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *