Search code examples
wpfwcfodatawcf-data-servicesvisual-studio-2017

WCF Data Service reference in WPF Project in VS2017


I'm having issues adding a service reference to my WPF project in VS2017. The service itself is a WCF Data Service using EntityFramework (EntityFrameworkDataService). In VS2013 that I was using before, I didn't have any issues adding services to my WPF project. I upgraded to VS2017 last month, and recently made some changes to the WCF service and needed to refresh the reference in my WPF project. I couldn't seem to get it to refresh so I deleted the reference and started trying to re-add the reference and now I'm greeted with this error message:

The specified OData API cannot be added because OData APIs are now only supported with Connected Services.

For more information, please see: https://aka.ms/odatavsclientguidance

That provided link does not have any info regarding VS2017 setups. It recommends to use the 'OData Connected Service' extension but that extension does not support VS2017 (tried it but got a "not compatible" message). I also found the 'VS WCF Connected Service' extension for VS2017, but it doesn't appear to support WPF projects (or atleast I couldn't figure it out).

Has anyone ran into this issue with adding a WCF Data Service reference to a WPF project? Any other suggestions that I could try?


Solution

  • I typically generate my clients via the DataSvcUtil.exe which is part of the .net framework

    e.g.

    "%windir%\Microsoft.NET\Framework\v4.0.30319\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:CSharp /out:c:\temp\DataService.cs /uri:http://localhost:16584/DataService/

    The MSDN docs: https://msdn.microsoft.com/en-us/library/ee383989(v=vs.110).aspx