WCF Data Service reference in WPF Project in VS2017 WCF Data Service reference in WPF Project in VS2017 wpf wpf

WCF Data Service reference in WPF Project in VS2017


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


As TGRA so eloquently stated, the best bet for VS2017 at time of writing is to use the dataserviceutil.exe. To make things simpler for myself I do the following:

  1. In File Explorer, navigate to the datasvcutil.exe using the path as follows: %windir%\Microsoft.NET\{{YOUR_PROCESSOR_ARCHITECTURE}}\{{YOUR_FRAMEWORKVERSION}}

  2. Hold shift and right-click. Select Open Commandwindow here (or command prompt if you prefer.

  3. Now execute a datasvcutil.exe command like so for C#: datasvcutil /language:Csharp /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.cs /uri:{{URL_TO_SERVICE}}.svc

  4. OR execute a datasvcutil.exe command like so for Visual Basic: datasvcutil /language:VB /out:{{PATH_TO_PROJECT}}/{{SERVICE_NAME}}.VB /uri:{{URL_TO_SERVICE}}.svc

And voila, you're done.