5

Is there a way to easily add a web service reference to a Visual Studio 2015 console application?

cymorg
  • 534
  • 2
  • 10
  • 27
  • For WCF services right click, add, service reference. For classic web services right click, add, service reference, click on the advanced button and then add web reference. – Rauland Aug 16 '15 at 17:01
  • The 'advanced' button isn't present. Did I forget to install some part of VS2015? – cymorg Aug 19 '15 at 01:00
  • I'm running VS 2015 Pro, I have a Database Project, but no option in the menu for Add > Service Reference (just Database Reference, Reference and Connected Service :( ) – SeeCoolGuy Oct 06 '15 at 23:30
  • @SeeCoolGuy, every find a solution for this? I don't have this option either. – James Hill Feb 04 '16 at 14:16
  • Correct answer is below. – cymorg Feb 04 '16 at 18:17
  • @JamesHill I had to create another class project, this offered the service reference option, then I reference the other project which does show the service reference, [Link to MS Doc](https://msdn.microsoft.com/library/hh708954%28v=vs.110%29.aspx) for my database project I had to use the command line to serialize my webservice dll. – SeeCoolGuy Mar 11 '16 at 15:53
  • A closely related answer [here](https://stackoverflow.com/a/2158270/465053). – RBT Sep 19 '17 at 08:12

2 Answers2

14

If you don't have References -> Add Service Reference, you probably use VS2015 and new Console Applicaiton template, to add WCF service you need to:

  • Right click on References -> Add Connected Service
  • Click 'Find more services...' at the bottom of window.
  • Search for 'Visual Studio WCF Connected Service' and install
  • After VS restart, by clicking on 'Add Connected Service' you will be able to do what you wanted.

edit: Link to documentation of 'Visual Studio WCF Connected Service': https://blogs.msdn.microsoft.com/webdev/2015/12/15/wcf-connected-service-visual-studio-extension-preview-for-asp-net-5-projects/

user1214919
  • 384
  • 4
  • 14
7

Right click References -> Add Service Reference.

(i.e. don't right-click the Project name.)

markau
  • 854
  • 8
  • 21
  • 3
    And if **Add Service Reference** doesn't exist in a console app? – James Hill Feb 04 '16 at 14:28
  • 1
    @JamesHill Then you're in a .NET Core application. The Add Service Reference option was removed, probably because 90% of WCF service proxies don't work against .NET Core. They recently released an extension called WCF Connected Service [here](https://visualstudiogallery.msdn.microsoft.com/c3b3666e-a928-4136-9346-22e30c949c08) but the proxies generated are very different from what svcutil used to output, and may or may not work with the service, especially if it uses SOAP. Your best bet is to switch to a regular console application or target net451 and add the service file gen'ed by svcutil. – Asad Saeeduddin May 20 '16 at 19:33