web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

adding a service reference create duplicated definitions for enums and methods

(0) ShareShare
ReportReport
Posted on by 54,086 Moderator

I'm adding Navision Web Services to a simple Windows Forms Application using Add Service Reference functionality inside Visual Studio 2010, the reference are generated but inside the code there are duplicated definitions that stop the code from compiling, for example:

Error

The namespace 'WindowsFormsApplication1.ServiceReference1' already contains a definition for 'Status' C:\Trash\WindowsFormsApplication1\WindowsFormsApplication1\Service References\ServiceReference1\Reference.cs

and inside Reference.cs I have

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1015")]
[System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:microsoft-dynamics-schemas/page/salesheaderpage")]
public enum Status {
/// <remarks/>
Open,
/// <remarks/>
Released,
/// <remarks/>
Pending_Approval,
/// <remarks/>
Pending_Prepayment,
}

and

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="Status", Namespace="urn:microsoft-dynamics-schemas/page/salesheaderpage")]
public enum Status : int {
[System.Runtime.Serialization.EnumMemberAttribute()]
Open = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Released = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
Pending_Approval = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
Pending_Prepayment = 3,
}

I already tried to uncheck Reuse types in referenced assemblies but the duplicated definitions are still generated in both cases.

any ideas?

the question is also posted on stackoverlflow: http://stackoverflow.com/questions/20091836/adding-a-service-reference-create-duplicated-definitions-for-enums-and-methods

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    A user on stackoverflow proposed a workaround that works, it's necessary to use the svutil utility in order to manually create the proxy classes, more details in the link included in my question.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans