WCF Data Services Tools for Windows Store Apps and NuGet Package Restore

October 21st 2012 NuGet WCF Windows Store

If you've tried accessing an OData feed from a Windows Store apps you've already come across WCF Data Services Tools for Windows Store Apps. It's a downloadable package which extends the Add Service Reference functionality in Visual Studio 2012 to support OData feeds. Without it OData feeds can't be added as services references to a Windows Store app project.

The interesting thing about this installer is that it doesn't add the required references (Microsoft.Data.OData.WindowsStore and Microsoft.Data.Services.Client.WindowsStore) to the project directly but as NuGet packages instead. As it is also mentioned on the download page, this will make it possible to update the packages directly via NuGet. Unfortunately this approach also has a downside: at the time of writing these two packages are not available on NuGet at all. This is not a problem when you're working on the project from a single machine only, but it will make building the project a challenge on another machine if you're retrieving it from a source control system with NuGet package restore enabled. In this case the required references will not be present in the packages subfolder of the solution and NuGet will fail to restore them since it won't find them in the default package source.

The best way to make this work is to add another package source to NuGet, pointing to your local folder where the downloaded installer has put the packages, i.e. c:\Program Files (x86)\Microsoft WCF Data Services\5.0\bin\NuGet. I suggest you define it as the secondary package source, so that after the packages are available directly from NuGet, they will be retrieved from there instead from your local disk.

You can add the package source either through Package Manager Settings in Visual Studio Options window:

Package Manager Setting in Visual Studio

Or by modifying the NuGet.config file:

<?xml version="1.0" encoding="utf-8"?>
    <add key="NuGet official package source" 
        value="https://go.microsoft.com/fwlink/?LinkID=206669" />
    <add key="WCF Data Services Package Source" 
        value="c:\Program Files (x86)\Microsoft WCF Data Services\5.0\bin\NuGet\" />
    <add key="All" value="(Aggregate source)" />

Get notified when a new blog post is published (usually every Friday):

If you're looking for online one-on-one mentorship on a related topic, you can find me on Codementor.
If you need a team of experienced software engineers to help you with a project, contact us at Razum.
Creative Commons License