SVCUtil跳过wsdl的complexType以避免重复

我在我的本地 – A.WSDL和B.WSDL上下载了多个wsdl文件

A.WSDL具有与B.WSDL 相同的复杂类型集(接近100),但方法/操作是不同的。

例如:A.WSDL具有复杂类型并且操作正在创建新操作

B.WSDL具有相同的复杂类型并且操作是读取操作

我使用SVCUtil在客户端生成存根到单个文件和具有相同命名空间的存根。 但得到以下错误:

错误:validation导出期间生成的某些XML模式时出错http://mylocalhost/object:Book已经声明。

约束是:

1)我将无法更改WSDL文件。

2)想要将生成的存根类放在单个名称空间中。

3)没有wsdl.exe

是否有任何方法可以跳过重复的complexType或覆盖?

我引用丹尼尔罗斯在这里提供的内容

 "I think you are looking for something like the /shareTypes feature in wsdl.exe. If you want to correctly share types all you need to do is generate clients for both service at the same time. You can do this by passing the location of the metadata for both services to svcutil: svcutil [service url1] [service url2] When you pass both services to svcutil at the same time svcutil can figure out which types are shared and only generate one type instead of many. If you want svcutil to generate existing types instead of new types, you need to 'reference' the existing types in a DLL: svcutil /reference:MyTypes.dll [service url1] [service url2] If there are types in the referenced DLL that you don't want to be used in code generation, you can use the /excludeType switch to keep that type from getting generated." 

我是通过编写批处理文件来完成的。

方法是1)使用SVCUtil为A.wsdl创建代理类

2)将它们编译为.dll文件

3)使用SVCUtil为B.wsdl创建引用#2中创建的dll文件的代理类。

以下是代码行:

"Your_Windows_SDK_Path\Bin\SvcUtil.exe" A.wsdl /language:C# /out:A.cs

"Your_Windows_.NetFramework_Path\csc.exe" /target:library /out:myreferences.dll A.cs

"Your_Windows_SDK_Path\Bin\SvcUtil.exe" B.wsdl /r:myreferences.dll /language:C# /out:B.cs /mergeconfig /config:output.config