Friday, November 1, 2013

Upgrading Windows Azure Service projects to Visual Studio 2013 does not work out-of-the-box


This morning I decided to upgrade my cloud service project from Visual Studio 2012 to 2013. The upgrade requires installing the Windows Azure SDK 2.2, and then do an automatic upgrade of the project.

On the surface everything looked fine!

However, when I started deploying the upgraded service to Azure, the deployment never completed.

Having spent quite some time trying different things with the Azure deployment, I decided to try a local deployment in the emulator. I was expecting everything to work fine, but I found out that my worker role just kept on recycling in the emulator! It would call OnStart(), then Run() followed by a message that Run() completed which triggers a role restart.

The next logical step was to debug what was going on in the service, so I added breakpoints to OnStart and Run, and to my surprise the debugger never kicked in…

By then I concluded that something was completely broken. Next up, I tried creating a new service from the Visual Studio templates, which worked and debugging also worked.

After comparing the project files, I finally figured out that Visual Studio 2013 upgrade had failed to upgrade the version of the Azure references!

I had to update the csproj file and manually change the version number on the following references

Assembly
From
To
Microsoft.ServiceBus
2.1.0.0
2.2.0.0
Microsoft.WindowsAzure.Diagnostics
2.1.0.0
2.2.0.0
Microsoft.WindowsAzure.ServiceRuntime
2.1.0.0
2.2.0.0
Microsoft.WindowsAzure.Storage
2.0.0.0
2.1.0.0

 

After that I also had to update the same version numbers in the App.config file of the service and everything was working again.