A minor addendum to the last post…
Last time I described the client proxy generation as it happens from within Visual Studio (“Add service reference…”). For those who want to use the command line tool svcutil.exe, there are a few things to keep in mind:
- It is not sufficient, to provide the app.config via the /config parameter. This configuration file is only for output; to provide a configuration file as input you need to pass it in via the /svcutilConfig parameter.
- Additionally the assembly containing the import extension has to be found by svcutil.exe. This works automatically if the assembly resides in the GAC. In other cases the assembly has to be provided using the /reference parameter.
- Lastly the namespace for the generated code needs to be provided as it is not automatically inferred by the tool. This involves a somewhat awkward syntax…
All together results in a command line similar to this (line feeds for better readability):
svcutil
/config:app.config
/svcutilConfig:app.config
/reference:TrackingPolicy.ServiceModel.dll
/namespace:*,TrackingPolicy.TestClient.TestService
http://localhost:33333/Services/TestService.svc?singleWsdl
Best put in in a batch file, you don’t wan to retype that every time…
That’s all for now folks,
AJ.NET
Leave a Reply