Question

I have successfully added a service reference to my Visual Studio 2013 project.

I cannot however reference it in code.

For example, given the project name "myproject", and the service reference name "thirdpartyasmx", I cannot use this using directive...

using myproject.thirdpartyasmx

I cannot instantiate the class directly either...

thirdpartyasmx test = new thirdpartyasmx();

I have tried building the solution before trying to reference the service reference.

This is not something I do regularly, so I'm afraid I'm missing a step.

Was it helpful?

Solution

UPDATED based on OP feedback

When you click on Add Service Reference, click on the Advanced button in the bottom left of the dialog box:

enter image description here

Clear the Reuse types in referenced assemblies checkbox (by default it's checked).

enter image description here

OTHER TIPS

You don't need to use the using directive at the top of the class, you can just instantiate the service reference inside the class using the name you gave to the service when referencing it:

 public class MyClassName
 {
     protected void SomeMethod()
     {
         thirdpartyasmx.ThirdpartyasmxServiceClient service = new thirdpartyasmx.ThirdpartyasmxServiceClient();
     }
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top