Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:13:53+00:00 2026-06-04T10:13:53+00:00

Similar to: member names cannot be the same as their enclosing type except I

  • 0

Similar to: member names cannot be the same as their enclosing type except I can’t change the metadata, I want to just ignore the class entirely.

I am trying to add a Service Reference in Visual Studio 2010 but I get the following error.

The custom tool ‘DataServiceClientGenerator’ failed. Data service
client code-generation failed: Schema specified is not valid. Errors:
(0,0) : error 0042: Name foo cannot be used in type
Microsoft.Crm.Sdk.Data.Services.foo. Member names cannot be the
same as their enclosing type..

I understand that this error is because someone named a field foo in the object foo but I can’t change that..

so without being able to make any changes within CRM, how can I generate my service reference?

I have thought of downloading the $metadata and then removing the offending type and then saving it (as the type is not one that I will be using anyway). But I do not know how to get this to work because it’s not overly straight forward.

I have tried making the service reference with both C# and VB.NET and neither worked, ideally it would be a solution that works for both, but at this point I would be open to a solution that only works for one of these.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:13:54+00:00Added an answer on June 4, 2026 at 10:13 am

    I have worked out how to resolve this issue.

    http://localhost/myWcfDataService.svc/$metadata
    

    Save this result to disk such as c:\metadata.csdl

    Then manually edit the file and remove (or rename) the offending field (this will result in it not being usable in your service, but it is better than the whole service not working).

    Then run the following:

    c:\Windows\Microsoft.NET\Framework\v4.0.30319\DataSvcUtil.exe /language:CSharp /in:c:\metadata.csdl /out:c:\serviceReference1.cs
    

    Now add the newly generated serviceReference1.cs file to your visual studio project, look for the class that inherits from System.Data.Services.Client.DataServiceContext this is your service entry point.

    Further information can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does PHP have something similar to C++ member pointers? I want to use a
Why i cannot declare default arguments for member functions of a managed type or
Is the following free function implicitly inlined in C++, similar to how member functions
Similar to the way Resharper makes copying or moving a type to another file
Similar to what Facebook does on its newsfeed, I want to allow commenting on
Similar to How to change "Generate Method Stub" to throw NotImplementedException in VS? ,
Similar Stack Overflow Question I want users to be able to search through my
Similar to htmlunit , but for use with C#. I've seen that you can
I realize there are tonnes of similar questions already up here but I cannot
I use a method similar to the following to get some precomputed metadata related

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.