views:

606

answers:

3

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.

A: 

If you avoid using a service reference, and just include a reference to the the svcutil generated code then this should avoid this issue. Our DTO's are in shared assemblies.

Preet Sangha
A: 

I created a batch file which calls svcutil and added it as a pre-build task to avoid this being a manual operation. This has solved my problem, but I am still not sure why there is a different behaviour between svcutil and the vs2008 gui method.

ptutt
+4  A: 

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.

oefe
This was a huge help, it set me on the right direction to dealing with a problem that was causing us issues for days! Thanks!
Luke Bennett