33

Is it possible to add a web reference to my project in Visual Studio 2012? In Visual Studio 2010 it was possible by clicking the "Advanced" button in the "Add Service Reference" dialog, as it is written on this page : Add Web Reference in Visual Studio 2010

But in Visual Studio 2012 there is no section "Compatibility" in the "Service Reference Settings" and no "Add Web Reference" button in this dialog. I want to use SOAP web-service, but it works correctly only when I add it as Web Reference (in .NET Framework 2.0 compatibility mode. If I Add it as usual service reference I have an exception during using this service).

How to add old-style web reference to my project?
Or how to use my web service with new style of service references?

Thanks

Aju
  • 503
  • 1
  • 8
  • 26
ibogolyubskiy
  • 2,271
  • 3
  • 26
  • 52

4 Answers4

70

check the link below

MSDN Link

To add a Web reference to a project

1 In Solution Explorer, right-click the name of the project that you want to add the service to, and then click Add Service Reference.

The Add Service Reference dialog box appears.

2 In the Add Service Reference dialog box, click the Advanced button.

3 The Service Reference Settings dialog box appears.

4 In the Service Reference Settings dialog box, click Add Web Reference.

The Add Web Reference dialog box appears.

Liam
  • 27,717
  • 28
  • 128
  • 190
  • 3
    Sorry, but I can't find "Add Web reference" button in Service Reference Settings Dialog. I use Visial Studio 2012 Ultimate on Windows 8 and write Windows Store Application (Metro-Style). May be I need to install any third-party addins? Here the screenshot of my Service Reference Settings dialog: https://dl.dropbox.com/u/31216763/SRSettings.png Can you show me screenshot of your dialog? – ibogolyubskiy Oct 22 '12 at 19:47
  • 1
    sorry for late reply but check this link http://www.c-sharpcorner.com/UploadFile/99bb20/consume-web-service-in-metro-style-app/ –  Oct 22 '12 at 23:27
  • You also need to make sure that your project targets .NET framework 3.5 or below. To change this, right click on your project and click properties. In the Application tab, check Target Framework. – coder1 Jan 10 '13 at 15:43
  • Thanks for your clean answer. Knowing differences between **Service reference** and **web reference** may be useful ,too: http://stackoverflow.com/questions/2158106/web-reference-vs-service-reference – A.Dara Feb 14 '15 at 09:58
6

Solved. CheckBox "Always generate message contracts" Helped. Thanks for all.

ibogolyubskiy
  • 2,271
  • 3
  • 26
  • 52
  • you should probably mark informative topic as an asnwer. I garantee, community will be thankful for that :) – xacinay Jun 27 '14 at 09:46
4

From MSDN:

  1. In Solution Explorer, right-click the name of the project that you want to add the service to, and then click Add Service Reference. The Add Service Reference dialog box appears.

  2. In the Add Service Reference dialog box, click the Advanced button. The Service Reference Settings dialog box appears.

  3. In the Service Reference Settings dialog box, click Add Web Reference. The Add Web Reference dialog box appears.

Hope this helps!

lhan
  • 4,585
  • 11
  • 60
  • 105
  • http://stackoverflow.com/questions/13018295/how-to-add-a-web-reference-visual-studio-2012#comment17668801_13018451 – ibogolyubskiy Oct 22 '12 at 19:52
  • Hmm. do you have Visual Studio 2010 available? I know it works in VS2010 so maybe if you had that (or a trial), you could add the reference there, and then reopen the project in 2012 (which would probably have to convert it back to a 2012 project). This seems kind of hacky, but I'm not sure what else to do if you don't have the option. It should be there. – lhan Oct 22 '12 at 20:25
  • Yes, I have Visual Studio 2010. But I just looked, this button is present in Visual Studio 2012, but only in Windows Forms Application project. When I try to add web reference to Windows Store Application, that also known as Modern-style (Metro-style) application I see modified Service Reference Settings dialog without Add Web Reference button (shown at screenshot). There is a way to beat it, or I'll have to manually configure SOAP requests to the server and handle the answers? – ibogolyubskiy Oct 22 '12 at 20:51
  • I'm really not sure. I'm familiar with Visual Studio, but not 2012 or Metro-style apps. – lhan Oct 22 '12 at 21:23
1

Visual Studios 2013 uses newer version of .NET Framework 4.5.1, which will not work with this web service http://wsf.cdyne.com/weatherws/weather.asmx and others. but using .NET 3.5 works!

so, if your starting a new project select from drop down menu .NET Framework 3.5 or if you are already in a project and want to change Framework

1 Click [DEBUG] > '<YOUR_PROJECT_NAME>' Properties

2 Click [Build] and change target Framework

3 Click [OK]
jobes
  • 11
  • 2