Search code examples
c#wcfnamespacesprojects-and-solutions

WCF Service namespace colision, all in same solution


I have WCF Class library, WCF Service Client and WCF Service Server in one visual studio solution and i have problem.

In WCF Service Client i using worker classes library, using common types class library, and my svcutil.exe classes generated from .wsdl have collision with this classes. In WCF Class library in service interface i using this same common types from class library that using this worker classes library.

Is any way to use in my solution original classes from library that i can reference in this project? And use generated classes from .wsdl only when i'm in other solution? or maybe i should design this in other way?

Thanks!


Solution

  • You can use the /namespace argument to svcutil.exe to specify a different namespace for generated classes.

    If you want to share the same datacontract definitions between both client and server that residing in your WCF Client Library you can skip svcutil.exe altogether and use ChannelFactory directly. The link has an example on how to do this.