DevMov2015: Azure and DocumentDB

It’s been a wild ride for the Developer Movement this year, and it’s slowly coming to an end. We’ve just seen #devMania come and go, and hopefully you managed to get your apps in for a lot of points.

If you’re like me, you’ve gotten a lot of points, but you’re still just a bit short. Maybe you joined late, or maybe you’re just going for those last few points, but your big prize is just out of reach. If that’s the case, the mini challenges and final few app submissions mean a lot. Well, I thought I’d help you bypass a pitfall I hit with this month’s Mini Azure challenge and DocumentDB.

If you go to this page, you’ll find a tutorial for getting DocumentDB up and running on Azure (free trial is very important as is using the preview portal). Now, what you’ll want to do is launch Visual Studio and create a new Console Application.

Next, at the bottom of the tutorial you’ll find a link to a GitHub project with the code for this tutorial. If you’re like me, that code won’t run (NuGet error for getting the packages). Don’t worry. That’s why we created the Console Application.

Open the Program.cs files in your application and the downloaded one. Copy the contents from the downloaded file to your file (watch out for the namespace!). Next, you’ll need to import a package.

Open Tools > NuGet Package Manager > Package Manager Console, like in this screen-shot.

image

In the console, paste the following:

 Install-Package Microsoft.Azure.Documents.Client -Pre 

You’ll want to make sure your using statements match the following:

 
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
using Newtonsoft.Json;

Next, replace the string values for EndpointUrl and AuthorizationKey with the URL and Primary Key values as you see in the tutorial. Run it, grab a screen-shot, and submit for your points!

This entry was posted in .NET, Azure and tagged , . Bookmark the permalink.

3 Responses to DevMov2015: Azure and DocumentDB

  1. You can remove the Microsoft.Azure.Documents package reference from the downloaded source example and just run nuget package console and use Install-Package Microsoft.Azure.Documents.Client -Pre to restore the necessary packages.

    • Mark says:

      Awesome work-around. I’d tried a few things to get the packages to install and nothing worked. Glad to hear there’s a quicker method.

Leave a Reply to tomwalker1313T Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s