Visual-studio – Sharing types in WCF using VS 2008 not working

svcutil.exevisual-studio-2008wcf

I am trying to share DTO's from my datalayer assembly between the client and WCF service. This works using svcutil, but doesn't work when using VS2008. VS2008 generates it's own DTO objects whereas svcutil uses the shared data type.

The svcutil parameters I used are:

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcUtil" 
          /serializer:DataContractSerializer
          /language:vb 
          /out:ServiceClient.cs
          /namespace:*,CommonWCF 
          /noconfig
          /reference:"D:\trunk\DataLayer\bin\Debug\DataLayer.dll"
          /collectionType:System.Collections.Generic.List`1
          http://localhost:3371/Common.svc

I read that VS2008 just calls svcutil behind the scenes, so why doesn't it work? I really want to avoid adding a manual process to the build process.

Best Answer

Just use ClientFactory<T>.

You don't really need either svcutil nor a service reference. The code which they generate is only a bloated wrapper around ClientFactory that adds virtually no functionality.

Related Topic