views:

17

answers:

0

I have several WCF services being consumed by different Silverlight applications. I am currently using slsvcutil.exe with a pretty standard setup to generate my Silverlight proxy objects:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/MyService.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll"

What I would like to do is share some types, specifically a base RequestMessage, ResponseMessage, and ApplicationFault between the multiple services and their generated Silverlight proxies. I would like these types to be in their own common Silverlight namespace so that I can use shared Silverlight code to do things poll a service request or check for a SOAP fault and translate it into a known exception type that can be thrown.

I thought that this could be done by using the /r or /reference switch on slsvcutil.exe by specifying the path to the DLL with the shared types. I tried building the proxy like this but it still seemed to be generating new incompatible types for the objects I was trying to share:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/Service.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll" /r:"C:\path\to\MySharedTypes.dll"

Any ideas on what might be going wrong? Or do I have the wrong impression of what the /r switch can be used for with slsvcutil.exe?