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,077 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
    54,077 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans