Reputation: 2764
When a Web Reference is added in Visual Studio the generated proxy class automatically uses a default namespace which consists of the application’s default namespace together with the web reference name. the problem is i have a profile web service which all my projects use that in order to authenticate. Because of the namespace i cant add a profile class as a link. Now I wonder if there is any way to manually set the Reference name? (or maybe there is a better way which could solve my problem.) So far I've found this:
1- Go to the service Reference.cs
and then rename the namespace.(the problem is every time i update the service the namespace goes back to the default)
2- I found this :Manually setting the namespace for a web service proxy class in Visual Studio(the problem is i have to change the build event which it could cause the unexpected errors.)
Upvotes: 5
Views: 7243
Reputation: 439
Use "Custom Tool" option with wsdl.exe and give the required parameters. Whenever you want to update the service reference run the custom tool by using below mentioned option.
/n[amespace]:namespace
For more information visit https://msdn.microsoft.com/en-us/library/7h3ystb6%28VS.80%29.aspx
Upvotes: 1