5

How do you generate a service reference via the command line that replicates the output of adding a service reference in Visual Studio for a WinRT application.

I have tried using svcutil (using local schema files):

svcutil.exe /internal /enableDataBinding /collectionType:System.Collections.ObjectModel.ObservableCollection`1 /NoConfig /noLogo /out:"Proxy.cs" /namespace:*,My.Proxy.Namespace "bin\Proxy\*.*" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\WindowsBase.dll"

This generates classes inheriting from System.Runtime.Serialization.IExtensibleDataObject which doesn't existing in WinRT and won't compile

I have also tried SLsvcUtil:

slsvcutil.exe http://Service1.svc?singleWsdl /namespace:*,My.Proxy.Namespace /out:"Proxy.cs" /language:CS /internal /enableDataBinding

This works, but doesn't generate Async methods, it generates call backs (which doesn't match the behaviour of adding a reference via Visual Studio)

J_D
  • 429
  • 2
  • 12
  • What do you mean exactly when you say that they clash? – Dave Lawrence Feb 21 '14 at 17:04
  • 3
    I mean if I call a method/operation from each service in the same class, there is potential for a namespace clash. The short version of the question is, how do I generate a Service Reference from the command line for use in a WinRT project? – J_D Feb 21 '14 at 18:20
  • Kind of, I used WEB API instead. Works for Windows 8/8.1 desktop and phone out the box (using HttpClient) and used a lot less memory than WCF (on the client), less bandwidth and performed a lot better from my tests – J_D Oct 22 '14 at 17:06
  • This is an old question, I'm aware, but any chance you could expand on your last comment regarding the usage of WEB API? I'm especially interested how this ties to utilizing existing WCF services... – MBender Sep 01 '16 at 08:18
  • For my situation I re-wrote our services with a WEB API and called them with simple http requests using HTTPClient. If re-writing isn't an option, you can make your WCF restful with a small amount of changes and can call the same way as you would with WEB APIs – J_D Sep 03 '16 at 12:50

0 Answers0