Interesting related videos

Loading...

Monday, May 12, 2008

svcutil with /r does not work for MessageContract

Hi,
I was trying to generate WCF proxy (Client) using svcutil.exe from Visual Studio 2008. I also need to use the /r parameter of the svcutil.exe so the generated proxy code will not include the objetcs from my other internal assemblies.
The command I use is something like:
svcutil.exe /async http://localhost:8080/MyService /r:"C:\My.dll" /tcv:Version35 /out:MyClient.cs

I saw that if my .NET MessageContract objects on My.dll still exists on my generated proxy, so I have to change these objects to DataContract objects and then the generated proxy was correct.

You also need to remember that if your internal objects (on My.dll) contain objects form other internal assembly, You have to include this dll also in your svcutil command. So you new command will look like:
svcutil.exe /async http://localhost:8080/MyService /r:"C:\My.dll" /r:"C:\MyOtherObjects.dll" /tcv:Version35 /out:MyClient.cs

Your,
Rotem

No comments: