Monday, February 23, 2009

Creating Service Reference: Failed to generate code for the service reference

I was working on Windows Service that was consuming another WCF Windows Service. I created a Service Reference in Visual Studio 2008 and noticed that client code was not automatically generating. The error I was getting was

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

The Windows Service I was working on was already full blown project with lots of references, so to limit possibilities I created another empty windows service and added Service Reference to one I need. Client code was generated with no problems! I decided to use new Windows Service as a base and added all required functionality to it and selected “Update Service Reference” and again it failed to generate a code!

image

After some time looking around there was an easy solution to fix a problem. You need to edit Service Reference Configuration by selecting “Configure Service Reference…” from right click menu.

image

In the dialog box Un-tick “Reuse types in referenced assembles” and click OK. Try to Update Service Reference. This worked for me!

References

.NET C# Broken WCF service reference in VS 2008

0
Show Comments: OR

0 comments:

Post a Comment