I've added a service reference to my mvc4 web project and left it with the default namespace "ServiceReference1", but when I wanna use that namespace, visual studio can't find it, like it doesn't exist, the webservice is up and working fine. What exactly am I doing wrong?
You have to right-click on project -> Add... -> Service reference and then paste path to wsdl file. Do this for each service. Also if your both projects are in one solution, you can just add a reference to project containing this services and generated code will be shared between projects.
(For a . 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.
In Solution Explorer, open your project's App_WebReferences folder and click the node for the Web reference you want to update. Right-click the reference and click Update Web Reference. The new files for the XML Web service are downloaded to your project.
I found the solution HERE which as Hoakie mentioned below instructions worked for me and my reference.cs is generated properly now:
1) Right click on Service Reference
2) Select Configure Service Reference
3) Uncheck "Reuse types in referenced assemblies"
and Voila!
This is caused by having the same namespace
name as class name.
Change your namespace to a name that is not the same name as your class and this will compile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With