svcutil wsdl Error: The type name: on the property:"Name" of type:"System.CodeDom.CodeNamespace" is not a valid language-independent type name

svcutil wsdl Error: The type name: on the property:"Name" of type:"System.CodeDom.CodeNamespace" is not a valid language-independent type name

当我使用服务模型元数据工具时出现以下错误

svcutil wsdl Error: The type name: on the property:"Name" of type:"System.CodeDom.CodeNamespace" is not a valid language-independent type name.

当我执行以下行时

svcutil my.wsdl /n:*,"www.abc.com/x" /out:my.cs

命名空间“/x”是错误的来源,但我无法修复它。我可以将源文档中的命名空间更改为 "www.abc.com" 并且它可以工作,没有错误,但这不是解决方案,因为我不拥有源 wsdl 并且无法将其更改为我喜欢的内容。

正如 DavidG 所指出的 www.abc.com/x 不是有效的命名空间

ServiceModel Metadata Utility Tool (Svcutil.exe)

Specifies a mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace.

To make sure that the message contract name does not collide with operation name, you should either qualify the type reference with ::, or make sure the names are unique.

Default: Derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types.

Short Form: /n Note: When generating types to use with XmlSerializer, only a single namespace mapping is supported. All generated types will either be in the default namespace or the namespace specified by '*'.