John
John

Reputation: 17471

.Net Generate Service Reference with Service Having type "System"

I'm trying to add an external service reference in a C# .Net 4.0 project where the service wsdl contains a type called "System", which results in something like this:

Namespace issue

As you can see, everywhere in Reference.cs where the "System" namespace is referenced, it instead believes it to be this System class instead, resulting in errors all over the place.

What would be the best way of resolving this naming issue?

Upvotes: 4

Views: 188

Answers (1)

CodeCaster
CodeCaster

Reputation: 151586

You can rename the generated System class (and all references to it) in the Reference.cs file, then add a [XmlRoot(ElementName = "System")] attribute to it so it will be (de)serialized properly.

You'll of course lose these changes when you regenerate the proxy.

Upvotes: 3

Related Questions