+ Start a Discussion

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?
 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")]

These attributes seem to describe a lot of classes.  Has anyone seen this issue before?  What am I doing wrong??
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.


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.