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,073 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

  • Verified answer
    Guido Preite Profile Picture
    Guido Preite 54,073 Moderator on at
    RE: adding a service reference create duplicated definitions for enums and methods

    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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,375 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans