Compatibility: Duplicate delegates generated

I have a project that references two separate web services that share the same namespace. When I add these references, code is generated that will not compile because the two web services both have a method of the same name. To illustrate:

In the service code:
Service1.asmx.cs:

namespace MyServices
{
publicclass Service1 : System.Web.Services.WebService
{
[WebMethod]
publicint Save() { ... }
}
}

Service2.asmx.cs:

namespace MyServices
{
publicclass Service2 : System.Web.Services.WebService
{
[WebMethod]
publicvoid Save() { ... }
}
}

When I add my references, I set the "Custom Tool Namespace" to be MyServices for both services, which makes it easier for me to refer back to the original classes. This worked great in VS.Net 2003, but in 2005 the code will not compile because the code generator generates delegates at the namespace level, causing a collision:

Reference.cs generated for Service1:

namespace MyServices
{
using ....

public partialclass Service1 : System.Web.Services.Protocols.SoapHttpClientProtocol
{ ... }

publicdelegatevoid SaveCompletedEventHandler(object sender, SaveCompletedEventArgs e);

}

Reference.cs generated for Service2:

namespace MyServices
{
using ....

public partialclass Service2 : System.Web.Services.Protocols.SoapHttpClientProtocol
{ ... }

publicdelegatevoid SaveCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

}

Is there some property I can set to make this work again? I would prefer to not have to name all of my methods uniquely at the namespace level instead of the class level. Any thoughts?
Thanks,
Todd Gray

[3539 byte] By [Todd.Net] at [2008-2-5]
# 1

You can rename the delegate to something else, and change the corresponding reference as well. looking at the operation, if it has the same signature, it should have the same delegate signature too, thus one of the could be deleted.

erymuzuan at 2007-9-8 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2
That's what I've had to do to get it to compile, but as this is generated code, I'll have to go back and delete/rename the delegates and eventargs code every time I update the reference. This is a possible solution, but not very desireable. And yes, even if the methods have the same signature, they could reuse a delegate, but the problem is that the tool is generating duplicates, so something will have to be deleted.

Todd

Todd.Net at 2007-9-8 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3
well, that's the way it is with the tool, there's no shortcut, unless you want to automate this using special build tool, or codeDom. I'll recommend using NAnt . use the exec task to exec wsdl.exe then write some custom task to remove one of the delegates, may be use the /sharetype option to maximize this.
erymuzuan at 2007-9-8 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified