Skip to content

Sharing Data Contracts #5632

Open
Open
@mrosenthal1058

Description

@mrosenthal1058

Describe the bug
My application has 8 Services, so I am running dotnet-svcutil on each service to generate a separate service reference for each with a unique namespace for each. The problem occurs when I consume multiple services in the same client, and reference a data contract that is shared among two or more of the consumed service. In the consuming client, I see a bunch of "'DataContractModel' is an ambiguous reference between 'WS_1_WebServiceNS.Data.DataContractModel' and 'WS_2_WebServiceNS.Data.DataContractModel'". Before conversion, I used this command: "svcutil.exe" ..\My.Service.Contracts.dll /directory:........\deployment to generate a unified wsdl and xsd for shared Data Contracts, and then "svcutil.exe" ..\deployment*.wsdl ..\deployment*.xsd /language:C# /n:http://tempuri.com/MyService/2016/05,WebServiceClient /n:http://tempuri.com/MyServiceData/2016/05,WebServiceClient.Data /o:..\My.Service.Client\MyWebSvcClientApiAuto.cs /config:..\My.Service.Client\App.config

Expected behavior
A method to either generate service references with a shared data component, or an ability to output a generated client class which avoids the namespace collisions.

Am I missing something? The only workaround I can come up with is to somehow merge the 8 wsdl documents, but using the old wsdl tool, won't generate a dotnet Core valid wsdl document.

Metadata

Metadata

Assignees

Labels

toolingAn issues related to any tool shipped from this repo.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions