Generating WCF Proxy Class with Proper Namespace
Posted by Keith Elder | Posted in WCF | Posted on 16-08-2007
Since I wanted to move my generated proxy class generated by svcUtil to a separate C# Class Library project I ran into another problem after I figured out how to generate the collection type I wanted. The problem I ran into was the namespace wasn’t correct. At first there wasn’t a namespace. I knew there was a namespace switch in the svcUtil.exe but the lack of documentation on it and examples left me scratching my head a few times. Why people don’t include examples of every single switch is beyond me. I guess I am too much of an educator to understand why simple things like that go undocumented.
The namespace declared for the data contract in the WSDL was something like http://My.Namespace/ and I wanted it to map to My.Proxy. Here is the switch for svcUtil that gave me what I wanted.
svcUtil /n:http://My.Namespace/,My.Proxy
Of course combine this with the post from yesterday where I mapped the collection type of List<> and we are on our way to creating a pretty good proxy for the service.
Thanks for the info that you posted here. I found it useful and it saved me tearing my hari out trying to get the namespace into the proxy.
thanks again
Sabry