Why does the / reference option for svcutil.exe not work?

I am trying to use svcutil.exe to generate - only service contracts (interfaces) from the .wsdl file set. When I do this (from http-host wsdl), it selects the included schemes and generates all the code for them.

Great.

However, I would REALLY want to use a set of classes already generated from schema files using the xsd.exe tool (the reasons for this are not important, suffice it to say that I need to have types in one assembly, and the service is enclosed in another). I managed to create an assembly containing all types.

The problem occurs when I try to get svcutil.exe to use types in this assembly. My command line looks something like this:

svcutil /target:code /noconfig /reference:my_types.dll http://path/to/wsdl 

This works fine, but the generated code contains duplicates of all types in the my_types.dll file. From the documentation for svcutil.exe, I understand that this is the exact problem that the / reference: parameter must undergo. In my case, however, it does not work.

Why?

+7
wsdl xsd
source share
2 answers
+5
source share

I had this problem. Something in the binary that I referenced / r was still building again in the generated code. One of the objects returned from one of the utility functions returned the returned data or some other terrible thing. I added a / r to the whole path to System.Data and fixed it.

/ r: "C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework.NETFramework \ v4.5.2 \ System.Data.dll"

+1
source share

All Articles