4

About a week ago I began trying to connect to an internal WCF web service. I received the error

Custom tool error: Failed to generate code for the service reference 'DynamicsCom'. Please check other error and warning messages for details.

Unforunately the only other errors pointed towards the same basic problem: my solution was unable to bring down the namespace used by the WCF web service. In fact, the Reference.cs class is completely blank save for the auto-generated comment.

enter image description here

Reference.cs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18063
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Everything I've read on the internet suggests I got to Configure Service Reference and uncheck Resuse types in referenced assemblies. And while this does work, in bringing down the namespace used in the WCF web service, it unfortunatley creates a number of other conflicts.

Both my project and the web service namespace use the Mircosoft CRM SDK, and when I uncheck the Reuse types in referenced assemblies checkbox a number of namespace "ambiguities" occur (between the SDK dll referenced in the solution and the web service namespace).

My question is: is there a way to specifically debug the causes behind the namespace not being brought down from the web service? The common solution just seems like a blanket approach that doesn't always diagnose the real problem.

NealR
  • 10,189
  • 61
  • 159
  • 299

3 Answers3

1

I had the same issue, and resolved it as follows

1 . Remove DynamicsCom from your service refernces

2 . Clean the solution

3 . Re add service reference and give the same name "DynamicsCom"

4 . Right Click on DynamicsCom and go to Configure Service References

5 . Re Build the solution, it should work fine now

thanks

mzh
  • 515
  • 8
  • 21
1

Try to un-check/remove Reuse types in referenced assemblies checkbox by right-clicking on added service reference (select the name whatever you have given) and go to Configure Service Reference, see blow screenshot:

Un-check this checkbox

Sohail xIN3N
  • 2,951
  • 2
  • 30
  • 29
0

I have the same problem too, but I look the solution here : Service Reference Error: Failed to generate code for the service reference

It was caused by assembly version between server and client are different, so I uncheck some of my reference, rebuild the project and success.

Community
  • 1
  • 1