4
votes

After googling a bit there is no definite answer of whether Visual Studio 2008 uses svcutil.exe or not? Visual Studio 2005 did use it, but do the RTM versions of Visual Studio 2008 use svcutil? A few blogs say it doesn't (and make it seem surprising)

and other sites say it does.

The reason I'm asking is we are flattening our WCF wsdl with a custom endpoint behavior extension (an implementation of IWsdlExportExtension/IEndpointBehavior) and using the flattened wsdl via Visual Studio 2008's Add Reference gives us compile errors as it is duplicating Types/Classes. The reference is added without any errors. SvcUtil, on the other hand, throws the duplicate class into a seperate namespace which fixes the build issue.

So SvcUtil works, but Visual Studio 2008 doesn't on some of our flatten wsdls. We are fine with continueing to use svcutil if the Add Service Reference in Visual Studio doesn't work, but are wondering if anyone knows if there are any implications in doing so. I couldn't find any evidence that we "shouldn't" be using svcutil, just that it isn't as easy as using the Add Service Reference in Visual Studio 2008.

5
There is a disadvantage. If your WSDL is accessible over HTTPS and the certificate is "invalid" (expired or generated for another hostname - say your on a cluster and your admins did a poor job :) VS will let you ignore the issue and ask you if you want to continue while svcutil.exe will not work at all (except the hostname issue which can be worked around by tweaking svcutil.exe.config file).Piotr Owsiak

5 Answers

4
votes

svcutil and VS2008 ultimately call into the same bit of WCF code. Whether it uses the actual exe or calls into a dll is a minor detail. If anything, I prefer the command line tool, as it allows more flexibility (or maybe I just like command line ;-p).

Note that WCF can re-use existing types, both via the IDE and from the command-line (/r?). But this type of namespace issue is just one of many things I prefer about using the command-line version.

1
votes

I've never seen any reason to believe that Visual Studio calls svcutil.exe, or wsdl.exe. In both cases, the console applications and Visual Studio use the same .NET Framework code to do their work.

Consider that some errors that occur during an "Add Service Reference" command show up in the Visual Studio "Errors" window, and not in the Output window. It is necessary to call a Visual Studio API to put messages in the Errors window, which svcutil.exe could not do.

1
votes

This is an old question and it came up when i was searching for something similar, so i'll mention what i found.

This blog post asserts that VS2008 doesn't use svcutil to generate proxies. I agree with him, as svcutil doesn't appear in the taskmanager processes list when you add a service reference. They also produce markedly different output - for instance svcutil doesn't produce proxies that are ready for consumption in a Silverlight app, you have to trim a reasonable amount of stuff out of them (like interfaces or object references that are not available in the assemblies that silverlight can use*).

Still, it isn't hard to write a little app that calls svcutil to do the hard work and then do a clean up on the generated files.

*it may be possible to avoid this issue by specifying a different framework version with the /targetClientVersion switch but i haven't tried that yet.

0
votes

I would rather say Visual Studio 2008 is not using svcutil.exe. Well, at least not directly.

I've used Process Monitor to see what applications are executed on my machine while adding a new service reference to my project and could not find "svcutil" in the log.

-1
votes

I would say that Visual Studio 2008 does use svcutil to generate proxy code.

As a proof, simply use Visual Studio to generate proxy code, and open the Reference.cs (assuming it was generated in C#) file, you will this header in the file:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Now, use svcutil command line to generate the proxy code. Open the generated file, and you will see the exact same header.

Beside, when you look at the available options in Visual Studio 2008 when you add a service reference, each option correspond to a svcutil argument.