Recently I had to work with an older Azure solution which was originally written on Visual Studio 2010 and Windows Azure SDK 1.6. When I opened the solution in VS 2012 it prompted me to upgrade the SDK version which caused a few problems. In this post I will go over a few of the main ones.
As an example (because I cannot use my real solution) I will be downloading and upgrading the BlobShare sample solution from http://blobshare.codeplex.com. This is a fairly complex solution published about a year ago. To build it requires the WIF (Windows Identity Framework SDK) and Azure SDK installed on your machine.
Opening the solution for the first time in VS2012
The first message is from Visual Studio saying that one of the projects requires a “One-way Upgrade”. In this case the project is the Azure BlobShare.ccproj. Once the solution is open you can look at the properties of the Azure project and see that it has been upgraded to October 2012.
At first you may be thinking “Great!” but then you try and compile and get a bunch of errors.
Missing the ServiceRuntime namespace
So once you compile you may get a number of reference missing warnings and compilation errors like this.
Could not resolve this reference. Could not locate the assembly “Microsoft.WindowsAzure.ServiceRuntime, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
The resolution to this is to remove and re-add the ServiceRuntime reference. The new reference should show Version 126.96.36.199
There are a few Azure libraries that have been added to NuGet but the Service Runtime assembly is not one of them.
Azure Storage Client Version 2.0
Occasionally when Visual Studio upgrades the projects it may add version 2.0 of the Storage Client library to the project. If that happens you will know from a large amount of errors. After version 1.7, 2.0 introduced a number of breaking changes to the framework.
To re-add version 1.7 to your projects, just use the NuGet package manager console.
Install-Package WindowsAzure.Storage -Version 188.8.131.52
After running that command in the package manager, you should not get any more storage API errors. I do recommend upgrading to the newest version of the storage library. Here is an article about the significant breaking changes in the library. Windows Azure Storage Team Blog
Once you get all of those straightened out you should have a successful compilation.
If you have any other problems with your solution upgrades, feel free to comment below or drop me a line at firstname.lastname@example.org
Thanks for reading.