function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
area51area51 

Web Reference Causes Namespace Error

I've imported a web reference into my C# project and when I try to build the app I get the following error:

The namespace 'Foo.Bar.SForceReference' already contains a definition for 'ExceptionCode'

Using the Object Browser, I can see there's are duplicates for exceptionCode, exceptionCodeField, exceptionMessage, exceptionMessageField, and PropertyChanged methods under the ApiFault class.  There are also duplicate entries in the ExceptionCode enumeration class.  Very strage...

Can anyone offer some insight into this?
area51area51
 The problem seems to be more pervasive than originally thought.  There are duplicates for several class methods as well as class attributes.  I cleaned up all of the duplicate code created when I imported the web reference; however I'm now getting errors about the attributes:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]

These attributes seem to describe a lot of classes.  Has anyone seen this issue before?  What am I doing wrong??
area51area51
I think I figured out my problem.  I was adding the WSDL as a Service Reference versus a Web Reference.  Doh!
Jon Mountjoy_Jon Mountjoy_
Thanks for posting your solution area51, even if it was quite funny. It's always good practice to post up what solved the problem so that future readers know.

Regards,
Jon
psoheilpsoheil

Thanks for posting this area51. It does make more sense for the WSDL to be a web reference since sales force is web based and  not native .NET.