Windows Phone “Failed to generate code for the service reference”

less than 1 minute read

Phew, I got this error at 22:30 today and I struggled until I found out a solution.  So if you face this issue, follow the steps stated below and you should get going!

Exact Error?

Error 10 Custom tool error: Failed to generate code for the service reference 'MyService'.
Please check other error and warning messages for details.
C:\Development\SolutionName\ProjectName\Service References\MyService\Reference.svcmap


  • Update Service Reference and try compiling
  • Right click the service reference, click on "Configure Service Reference" and uncheck "Reuse types in referenced assemblies" and try compiling
  • Open the WSDL file in the browser, and compare for illegal characters in the generated files  (.disco, .wsdl, .xsd) for path references that differ from the address set in the step above
  • Check for the ServiceReferences.ClientConfig if it has any incorrect entries
  • Try dropping the entire service reference and adding it again

Still not working, yes that's possible!

  • Clean the solution
  • Close the VS 2010, and restart it
  • Repeat the steps mentioned above