Notes from Daily Encounters with Technology RSS 2.0
 
# Sunday, October 21, 2012

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"?>
<configuration>
  <packageSources>
    <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\" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
</configuration>
Sunday, October 21, 2012 12:28:16 PM (Central European Daylight Time, UTC+02:00)  #    Comments [0] - Trackback
Development | Metro | NuGet | WCF | Windows Store
My Book

NuGet 2 Essentials

About Me
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

All Content © 2014, Damir Arh, M. Sc. Send mail to the author(s) - Privacy Policy - Sign In
Based on DasBlog theme 'Business' created by Christoph De Baene (delarou)
Social Network Icon Pack by Komodo Media, Rogie King is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.