Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use Visual Studio service references over svcutil?

So it seems like I have a couple of major options when getting WCF service proxy code into a project in Visual Studio:

  1. Use Visual Studio's built-in tooling for Service References

  2. Use a simple svcutil command, something like svcutil http://[my endpoint] /namespace:[my namespace] /noconfig (since I use some fairly standard bindings across projects), and drag the resulting file into my project (or upgrade in place).

To be clear, option 2 feels like the best one, albiet with no built-in tooling for updating. But the Service Reference dialog generates like a zillion files. Is there any obscure benefit to VS Service References that I'm missing?

like image 752
Brandon Linton Avatar asked Sep 19 '11 16:09

Brandon Linton


People also ask

What is Svcutil?

Svcutil.exe can be used to download metadata from running services, and save the metadata to local files. To download metadata, you must specify the /t:metadata option. Otherwise, client code is generated.

What is service reference in C#?

For . NET Framework projects, service reference enables a project to access one or more WCF Data Services. Use the Add Service Reference dialog box to search for WCF Data Services in the current solution, locally, on a local area network, or on the Internet.

What is Svcutil dotnet?

The Windows Communication Foundation (WCF) dotnet-svcutil tool is a . NET tool that retrieves metadata from a web service on a network location or from a WSDL file, and generates a WCF class containing client proxy methods that access the web service operations.

How do I add a service reference in net core project?

NET Core or . NET Standard project, this option is available when you right-click on the Dependencies node of the project in Solution Explorer and choose Manage Connected Services.) On the Connected Services page, select Add Service Reference. The Add service reference page opens.


2 Answers

Same reason why you build a .net project with VS and not calling the compiler by hand from command line. The I of IDE stands for Integrated, it does things for you so you do not need to do those things manually from many separated places and procedures.

There is usually a way to do many of those things by hand or with a text editor and command prompt but lets be productive :-)

like image 91
Davide Piras Avatar answered Sep 20 '22 13:09

Davide Piras


If you also own the service, I'd say don't use either one. Instead, break up your contracts, entities, and client proxies into different assemblies that you can use both on the service and the client.

Kinda like described in WCF The Manual Way... The Right Way.

like image 43
Esteban Araya Avatar answered Sep 16 '22 13:09

Esteban Araya