Generate Silverlight 2 Proxy with SVCUtil.exe
createUnfortunaly Silverlight 2 didn’t ship with any utility to generate a proxy class from the command line. Generating service proxy classes as service reference isn’t the way to go for me. Michael Giagnocavo wrote a little utility that makes use of a dll shiped with Silverlight to generate a proxy gut this one fails for me when I generate a little more complex proxy then HelloWorld. for example when I use multiple namespaces etc.
The Proxy classes of SVCUtil aren’t compatible with Silverlight 2. But they are not that much different. So I wrote a little utility converts a SVCUtil generated proxy class to a proxy class Silverlight can use. It also makes it possible to seperate your data contracts and your proxy. To automate this I use a little commandline script that executes it all.
silverlightsvcutilrepair
Command script for SilverlightSVCUtilRepair
silverlightsvcutilrepair Source
Generating Silverlight Proxy
- Generate Async Proxy with SVCUtil
- Run SilverlightSVCUtilRepair.exe
- Include the generated file in your project
- Compile your code
Generate Silverlight Proxy with shared DataContracts
- Generate Datacontracts with SVCUtil
Give your datacontracts a different CLR Namespace(s) - Run SilverlightSVCUtilRepair.exe
- Generate Async Proxy with SVCUtil
Give the datacontracts a different CLR Namespace(s) - Run SilverlightSVCUtilRepair.exe
- Include your generated files in your project
- Compile your code
Thanks for this cool tools but does it correctly manage the /enableDataBinding flag ?
@Guillaume,
The /enableDataBinding flag was automaticly added by the tool. But I’ve made an update. Now you have to add the flag to svcutil
Thanks for the tool, I really needed this to get things going with services and silverlight.
In your Create.CMD application, what is XSDLOCATION supposed to point to? How do I generate the required xsd file?
Thanks,
Roy
@Roy
In my project I also had the original xsd’s the service was based off. But if you only have the wsdl or the uri to the wsdl you can use that too. Or you can download the wsdl using the WSDL download tool
The XSDLocation is [drive]:\[directory of xsdfile]\*.xsd. If you only have one .wsdl file it’s *.wsdl, the wsdl than contains the xsd schema’s.