Running svcutil.exe from the command prompt
Had a find today while working with WCF.
Several people have complained about how the “Add Service Reference” in Visual Studio 2005 mangles the namespacing of your proxy class file that gets auto-generated. Usually it starts the namespacing with YourAppNameSpace.YourServiceNameSpace and then lumps the partial class files for your object(s) returned from the service and the partial class files to invoke your service under that same namespace.
I did some searching through MSDN on svcutil.exe. I read that there was a \namespace option that could be used to control the namespace generated in the proxy class file. Before I began testing this option, another fellow developer was working along the very same lines; in fact, most of the week we both had been feeding on each other’s information. We would sit down, share the information and experiences we had, and then continue to test new theories or old theories with new perspectives.
These said collaborations brought about the simple idea of just running the svcutil.exe from the command prompt with no options defined:
svcutil.exe http://servername/WCFServiceHost/MyService.svc?wsdl
Those familiar with svcutil.exe know that a configuration file and a proxy class file are generated. In our case, two separate namespaces were created. One for our object(s) referenced from an external assembly and one for the service itself.