Passer au contenu principal

 Subscribe

Editor’s Note: This post comes from Avilay Parekh, Windows Azure Senior Program Manager.

Say you have a Windows Azure Cloud Service built with the June 2012 SDK, using .NET 4.0, and OS family 1 or 2. You want to update this to use .NET 4.5 and consequently OS family 3, which is Windows Server 2012. If you use the normal update path, which is to use the “update” button on the Windows Azure portal, or the “publish” button in Visual Studio, the update will fail with an error saying “Upgrade from OS family 1 to OS family 3 is not allowed”. This is a temporary restriction on the update policy that we are working to remove in an upcoming release. In the meant time there are two workarounds to getting your existing Windows Azure Cloud Service running with .NET 4.5 and OS family 3 –

  1. VIP Swap (recommended approach)
  2. Delete and Re-deploy

Both have different pros/cons that are mentioned in the table below. Detailed walkthroughs of both the options are provided in this blog.

Option 1: Update using VIP Swap (recommended)

Let’s assume that your original Cloud Service using .NET 4.0 and OS family 1 or 2 has been deployed to the Production slot in the cloud. The steps to update it to .NET 4.5 and OS family 3 are as follows –

  1. Upgrade the solution to the October 2012 release of Windows Azure Tools. 
  2. Manually edit the .cscfg file and change the “OSFamily” attribute of the “ServiceConfiguration” element to read “3”.
  3. Change the .NET framework of the WebRole project to .NET 4.5 and rebuild.
  4. Deploy the new application to your staging slot in the cloud.
  5. Perform a VIP Swap of the production and staging slots.

Option 2: Update by deleting and re-deploying

  1. Upgrade your existing solution to the October 2012 release of Windows Azure Tools. 
  2. Manually edit the .cscfg file and change the “OSFamily” attribute of the “ServiceConfiguration” element to read “3”.
  3. Change the .NET framework of the WebRole project to .NET 4.5 and rebuild.
  4. Delete your existing cloud application.
  5. Deploy your updated application to the cloud like you normally would.

Detailed Steps

Upgrade the solution to the October 2012 release of Windows Azure Tools.

 

  1. Open the solution in Visual Studio.
  2. Right click on the cloud project in the Solution Explorer. In the accompanying picture, the solution name is “Sdk1dot7”, the web role project name is “MvcWebRole1”, and the cloud project name is “Sdk1dot7”. Right-click on the cloud project “Sdk1dot7”.
     
  3.  Click on “Properties”. The properties sheet will show an “Upgrade” button. Note in the picture below, the properties page shows that this project was built the June 2012 SP1 Windows Azure Tools version. Click the “Upgrade” button. After the upgrade, if you check this properties sheet again, it should show that the current Windows Azure Tools version is October 2012.

Manually edit the .cscfg file and change the “OSFamily” attribute of the “ServiceConfiguration” element to read “3”. 


  1. In the Solutions Explorer click on the “ServiceConfiguration.Cloud.cscfg” file under the cloud project.

     

  2. Change the circled entry to “3” and save the file.
Change the .NET framework of the WebRole project to .NET 4.5 and rebuild.

  1. Open the properties sheet of the WebRole project by right-clicking the WebRole project and clicking on “Properties”.

  2. In the “Application” tab look for the “Target framework” dropdown. It should show .NET 4.0. Open the dropdown and select .NET 4.5. You’ll get a “Target Framework Change” dialog box, click “Yes” to proceed. The Target Framework should now read .NET 4.5
  3. Rebuild by hitting ‘F6’. You might get some build errors due to namespace clashes between some new libraries that have been introduced in .NET 4.5. These are easy enough to fix. If you cannot, feel free to add the comment and I’ll respond.

Deploy the new application to your staging slot in the cloud.

You can deploy from within Visual Studio or from the Windows Azure Portal. In this blog, I’ll show the steps to deploy through the portal.

  1.  Right click on the cloud project and select the “Package…” option.
  2. Click on the “Package” button on the dialog box that pops up.
  3. After the packaging is complete, a file explorer window will pop up with 2 files in it – the .cspkg and .cscfg.
  4. Go the Windows Azure portal at https://manage.windowsazure.com and select your cloud service. Click on the “Staging” tab (circled in red in the accompanying picture above).

     

  5. Once on the staging tab, click on the “Update” button on the bottom panel (circled in green in the accompanying picture below).
  6. You’ll get a dialog box prompting for the cspkg and cscfg that you generated from Visual Studio in step 4.c. Select “From Local” button for both and upload the files that were generated in step 4.c. Remember to check the “Update even if one or more roles contain single instance” if you have a single instance role. These options are circled in red in the picture below. Click on the check marked circle to proceed.
  7. At this point you will have your application running on OS family 3 and using .NET 4.5 in the staging slot and your original application using OS family 1/2 and .NET 4.0 in the production slot.

Perform a VIP Swap of the production and staging slots

  1. On either the production or the staging tab, click on the “swap” button located in the bottom panel next to the update button (circled in green in the accompanying picture).
  2. After this operation completes, you will have your application running on OS family 3 and using .NET 4.5 in place of the original application.

Delete your existing application in the cloud.

  1. Go the Windows Azure portal at https://manage.windowsazure.com and select your cloud service. Click the “STOP” button in the bottom panel (circled in green in the accompanying picture). Click “yes” on the dialog box that pops up.
  2. After your application is stopped, delete it by clicking on the “DELETE” button (circled in red in the accompanying picture). In the sub-menu that pops up, select “Delete production deployment for ….”.

If you have any questions regarding this post please comment below or reach out to me on Twitter @Avilay

–Avilay 

 

  • Explore

     

    Let us know what you think of Azure and what you would like to see in the future.

     

    Provide feedback

  • Build your cloud computing and Azure skills with free courses by Microsoft Learn.

     

    Explore Azure learning


Join the conversation