4

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
magellings
  • 175
  • 2
  • 10
  • 1
    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 Aug 02 '10 at 15:29

5 Answers5

4

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.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
1

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.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
1

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
slugster
  • 49,403
  • 14
  • 95
  • 145
0

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.

Piotr Owsiak
  • 6,081
  • 8
  • 39
  • 42
-1

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.

Philippe
  • 3,945
  • 3
  • 38
  • 56
  • I believe anytime you use CodeDom (see http://msdn.microsoft.com/en-us/library/y2k85ax6.aspx for more information) this comment is automatically included in the generated source file. So this could just mean that both svcutil and Visual Studio 2008 both use CodeDom. – Dan Esparza May 11 '09 at 19:39
  • Yup, could be CodeDom version. Apparently nobody knows the answer to that question... – Philippe May 12 '09 at 07:44
  • It is. I have written a custom code generator using CodeDom and the same comments appear in the output, even though I'm 100% sure I didn't add those. – Badaro Jul 22 '09 at 13:19
  • Dear down-voter, could you at least say in what this answer was not constructive? – Philippe Apr 20 '11 at 12:29