Azure Mobile Services managed client – now also from NuGet

Currently if you want to create a Windows Store application which uses Azure Mobile Services, the process would be to go to either the quickstart page of your application in the Azure Portal (or the Windows Azure downloads page) and install the Mobile Services SDK:

InstallMobileServiceSDK

After installing the SDK, you can then go to the Visual Studio project, and add a reference to the library, in the Windows Extensions tab:

AddReference

That’s simple, but we can make it simpler – and with the added bonus of avoiding the installation of code in your machine. NuGet is a Visual Studio extension (installed by default in VS 2012) that makes it easy to install and update libraries to Visual Studio project. To install the required references using NuGet:

1. Select “Manage NuGet Packages” in the project

ManageNugetPackages

2. Search for “Windows Azure Mobile”, select the “Windows Azure Mobile Services” package, and click install

SelectNuGetPackage

That’s it! NuGet downloads the necessary assemblies, and adds reference to it in the project. The package supports both Windows Store (managed) applications and Windows Phone 8 applications.

Quick caveat

Just one quick note: to use the Windows Azure Mobile Services NuGet package, you need to have the latest (2.2). If you have an older version, you may see this error:

NuGetFailedNeedsUpdate

If you get this error, go to the “Extensions and Updates” option of the Tools menu:

ExtensionsAndUpdates

And select the update for the NuGet Package Manager

ExtensionsAndUpdates-2

After the update the package installation should work.