views:

83

answers:

2

When I add a service reference to my Visual Studio 2010 C# project, a new class for one of the types defined in the WSDL will be generated. A de-facto equivalent definition of that type already exists in our solution in a different assembly.

When adding the SoapTypeAttribute to the existing class and replacing the references to the generated class in the generated code, everything runs perfectly and as expected.

How would I tell Visual Studio to use the existing class in the generated code?

A: 

This is not possible... you have to use the Classdefinition of the webservice.

You could try to define an Interface from your Webservice and derive your Class from that interface as a workaround.

Steav
The web service is actually a PHP application using NuSOAP. I have no idea how I would define that interface. Or I am misinterpreting what you're saying.
gencha
+1  A: 

Does the "Reuse types in existing assemblies" option not do what you want? (under the Advanced menu)

From the docs it appears that is what you are looking for.

Ryan Rinaldi
I assumed so, but either it means something else or Visual Studio doesn't recognize the existing class as a valid alternative. Perhaps I have to give it a certain attribute so it will qualify.
gencha