The WCF Data Services 5.0 RTM release includes an update to the Add Service Reference behavior in Visual Studio. For most project types that target .NET Framework 4.0, this means that when you add a new service reference, you will automatically get assembly references to the new client assemblies, and your client will be able to communicate with servers that support v3 of the OData protocol.
This does not happen by default for Web Site Projects, but there are some manual steps you can take to update these projects to use the new functionality. This applies to Web Site Projects only, not Web Application Projects or any other type of project with support for WCF Data Services.
Configuring a Web Site Project to work with WCF Data Services 5.0:
Add a Service Reference in the Web Site project.
How to: Add, Update, or Remove a Service Reference
This will add the service reference with assembly references to the WCF Data Services client that is included with .NET Framework 4.0, and not the updated version that is included with the 5.0 RTM release.
Update the project’s assembly references to point to the new client.
There are three ways to do this:
(Recommended) Use NuGet to install the Microsoft.Data.Services.Client package. Click the Tools menu, then Library Package Manager, then Package Manager Console. In the console, type Install-Package Microsoft.Data.Services.Client. You will still need to remove the reference to System.Data.Services.Client using one of the methods below.
Right-click the project name in Solution Explorer, select Property Pages, then choose the References tab. Remove the reference to System.Data.Services.Client, then add references to Microsoft.Data.Services.Client, Microsoft.Data.OData, Microsoft.Data.Edm and System.Spatial that were installed with WCF Data Services 5.0.
Edit the <assemblies> section in the project’s web.config file.
Remove the reference to System.Data.Services.Client:
<add assembly="System.Data.Services.Client, Version=184.108.40.206, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
Add references to the new client assemblies:
<add assembly="System.Spatial, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Data.Services.Client, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Data.OData, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Data.Edm, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Configure the project to use the new build provider for WCF Data Services.
Edit the web.config file to override the default DataServiceBuildProvider that is specified in the root web.config that is installed with the .NET Framework.
<add name="DataServiceBuildProvider" type="System.Data.Services.BuildProvider.DataServiceBuildProvider, Microsoft.Data.Services.Design, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
This step only needs to be done once per project and does not need to be repeated if additional service references are added. All other steps need to be done for each service reference.
Update the Reference.datasvcmap file for the service reference.
The Reference.datasvcmap file contains parameters that control how the code is generated for the service reference. The following parameters are the default for other project types and will allow your types to be used with data binding and will allow the client to communicate with services that support v3 of the OData protocol.
<Parameter Name="UseDataServiceCollection" Value="true" />
<Parameter Name="Version" Value="3.0" />
In the first sentence above, you say:
The WCF Data Services 5.0 RTM release includes an update to the Add Service Reference behavior in Visual Studio.
This doesn't seem to work with Visual Studio 11 BETA as when I try to add a service reference to a service that is version 3.0, I get the dreaded "only supports services up to 2.0" error. I vaguely recall there was a registry hack to fix this but can't find a link to it anywhere. Anyone have a suggestion?
Had the same problem today with VS2010 and Nuget version of WCF DS5. I resolved it by installing the WCF DS 5 MSI first (which included a bunch of tools, which I dont think the nuget version does). Then used nuget.
All worked fine after that.