C# svcutil错误:';方案定位';必须成功解决以下问题<;重新定义>;包含除<;注释>;

C# svcutil错误:';方案定位';必须成功解决以下问题<;重新定义>;包含除<;注释>;,c#,xsd,wsdl,svcutil.exe,redefine,C#,Xsd,Wsdl,Svcutil.exe,Redefine,我想从wsdl和一些xsd文件生成一个代理类(C#)。wsdl和xsd文件都位于我磁盘上的同一文件夹中。 我发出的命令是: svcutil.exe authenticateAndGetAssertionsOAP12v2.wsdl.xsd/t:code/l:cs/o:AuthAndGetAssertionsProxy.cs/n:,TestNamespace 但未生成代理类,我得到以下错误: 如果“SchemaLocation”包含-annotation-以外的任何子项,则必须成功解析 svcuti

我想从wsdl和一些xsd文件生成一个代理类(C#)。wsdl和xsd文件都位于我磁盘上的同一文件夹中。 我发出的命令是:

svcutil.exe authenticateAndGetAssertionsOAP12v2.wsdl.xsd/t:code/l:cs/o:AuthAndGetAssertionsProxy.cs/n:,TestNamespace

但未生成代理类,我得到以下错误:

如果“SchemaLocation”包含-annotation-以外的任何子项,则必须成功解析

svcutil还声明存在问题的文档ID为

其中一个xsd文件确实有效地重新定义了定义的complexType 在此名称空间中,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <xs:redefine schemaLocation="oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <xs:complexType name="UsernameTokenType">
            <xs:complexContent>
                <xs:extension base="UsernameTokenType">
                    <xs:sequence>
                        <xs:element name="NewPassword" type="xs:base64Binary"/>
                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:redefine>
</xs:schema>

我尝试过像这样完全限定schemaLocation URI:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
       <xs:redefine schemaLocation="file:///C:/AuthAndGetAssertionsSOAP12v2/oasis-200401-wss-wssecurity-secext-1.0.xsd">    
       <xs:complexType name="UsernameTokenType">
            <xs:complexContent>
                <xs:extension base="UsernameTokenType">
                    <xs:sequence>
                        <xs:element name="NewPassword" type="xs:base64Binary"/>
                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:redefine>
</xs:schema>

其中C:\authandGetAssertionsOAP12v2是wsdl和xsd文件的实际路径,但我仍然无法使其工作

以下是在oasis-200401-wss-wssecurity-secext-1.0.xsd中定义complexType UsernameTokenType的方式,仅供参考:

<xsd:complexType name="UsernameTokenType">
        <xsd:annotation>
            <xsd:documentation>This type represents a username token per Section 4.1</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="Username" type="wsse:AttributedString"/>
            <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute ref="wsu:Id"/>
        <xsd:anyAttribute namespace="##other" processContents="lax"/>
    </xsd:complexType>

根据第4.1节,此类型表示用户名令牌
我搜索了很多,但是我找不到任何解决方案,但是在阅读了这篇文章之后

我开始认为问题可能在wsdl的其他地方。有什么建议吗