You are writing an application for Windows – perhaps a Console App or a WPF Application – or maybe an old-school Windows Forms app. Every is humming along. Then you want to interact with Windows Azure storage. Easy, right? So you Right-Click on the References list in Visual Studio, pop up the trusty old Add Reference dialog box, and search for Microsoft.WindowsAzure.StorageClient in the list of assemblies.
But it isn’t there!
You already know you can’t use the .NET Managed Libraries for Windows Azure in a Silverlight app, but you just know it is okay in a desktop application.
You double-check that you have installed Windows Azure Tools for Microsoft Visual Studio 1.2 (June 2010) (or at least Windows Azure SDK 1.2 (last refreshed from June in Sept 2010 with a couple of bug-fixes)).
You sort the list by Component Name, then leveraging your absolute mastery of the alphabet, you find the spot in the list where the assemblies ought to be, but they are not there. You see the one before in the alphabet, the one after it in the alphabet, but no Microsoft.WindowsAzure.StorageClient assembly in sight. What gives?
Look familiar? Where is the Microsoft.WindowsAzure.StorageClient assembly?
Azure Managed Libraries Not Included in .NET Framework 4 Client Profile
If your eyes move a little higher in the Add Reference dialog box, you will see the problem. You are using the .NET Framework 4 Client Profile. Nothing wrong with the Client Profile – it can be a friend if you want a lighter-weight version of the .NET framework for deployment to desktops where you can’t be sure your .NET platform bits are already there – but Windows Azure Managed Libraries are not included with the Client Profile.
Bottom line: Windows Azure Managed Libraries are simply not support in the .NET Framework 4 Client Profile
How Did This Happen?
It turns out that in Visual Studio 2010, the default behavior for many common project types is to use the .NET Framework 4 Client Profile. There are some good reasons behind this, but it is something you need to know about. It is very easy to create a project that uses the Client Profile because it is neither visible – and with not apparent option for adjustment – on the Add Project dialog box – all you see is .NET Framework 4.0:
The “Work-around” is Simple: Do Not Use .NET Framework 4 Client Profile
While you are not completely out of luck, you just can’t use the Client Profile in this case. And, as the .NET Framework 4 Client Profile documentation states:
If you are targeting the .NET Framework 4 Client Profile, you cannot reference an assembly that is not in the .NET Framework 4 Client Profile. Instead you must target the .NET Framework 4.
So let’s use the (full) .NET Framework 4.
Changing from .NET Client Profile to Full .NET Framework
To move your project from Client Profile to Full Framework, right-click on your project in Solution Explorer (my project here is called “SnippetUploader”):
From the bottom of the pop-up list, choose Properties.
This will bring up the Properties window for your application. It will look something like this:
Of course, by now you probably see the culprit in the screen shot: change the “Target framework:” from “.NET Framework 4 Client Profile” to “.NET Framework 4” (or an earlier version) and you have one final step:
Now you should be good to go, provided you have Windows Azure Tools for Microsoft Visual Studio 1.2 (June 2010) installed. Note, incidentally, that the Windows Azure tools for VS mention support for
…targeting either the .NET 3.5 or .NET 4 framework.
with no mention of support the .NET Client Profile. So stop expecting it to be there!
Pingback: Why Don't Windows Azure Libraries Show Up In Add Reference Dialog … « Invitation codes
Pingback: Programming Windows Azure Blob Storage in One Page of Code « Coding Out Loud
Thanks. This gets me every time and every time my web search pulls up this page. Lol.
@Donovan – hope it was helpful every time. 🙂
Hi, I was able to do that correctly. However, I’ve got one small problem:
I can now include Microsoft.WindowsAzure.StorageClient without any problems. However, whenever I try to include “Microsoft.WindowsAzure” so that I can use CloudStorageAccount I get errors. Does anyone know what the problem might be?