Automated way to add service references to client

Jul 8, 2009 at 10:32 PM

Hi,

I have been developing a number of WCF services (37 to be exact).  I want to add the service references to several different clients.  Is there any automated way that I can add all of the references without right clicking the project menu, click Add Service Reference...etc...etc.?

I have looked into Visual Studio Automation and they added a function called AddWebReference in VS2005, but they did not add a AddServiceReference function that I can see. 

Any help would be appreciated.

Thanks,

Richard

Developer
Jul 10, 2009 at 12:02 PM

Hi Richard,

You may try running the svcutil tool command line app to generate your client proxy types along with each app.config file configured. However you may still need to add these files to your project file which you may eventually do with an msbuild command.

Regards,

Hernan

Jul 13, 2009 at 6:44 PM

Hey Herman,

Thank you for the reply.  Whenever I have seen references to svcutil, it has been in a negative light.  Have you had good luck with that?

Thanks,

Richard

Jul 13, 2009 at 10:16 PM

Hey Herman,

I tried it out and it there was a lot less to it than I thought.  Just have to get past the man behind the curtain.

Thanks again,

Richard

Developer
Jul 14, 2009 at 12:08 PM

Hi Richard,

As you may have already figured out, the basic usage of svcutil is pretty easy and as far as I know, is the fastest way to use the internal API for handling the service reference generation (proxy and WSDL contract).

Otherwise you may need to use this API by calling the VS dlls like we did in WSSF where you can find a sample in the source code (Microsoft.Practices.ServiceFactory.Description.csproj in ContractGenerator.cs and MetadataDiscovery.cs).

Regards,

Hernan