Problem generating data contract code with SVCUTIL

2019-09-01 06:33发布

问题:

When i run the following command in the visual studio command prompt:

D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema>svcutil /t:code /language=C# *.wsdl *.xsd ..\ws-addressing\*.xsd ..\gml\3.1.1\base\*.xsd ..\ows\1.0.0\*.xsd ..\xlink\1.0.0\*.xsd ..\swe\sweCommon\0.0.0\*.xsd /out:MyServiceProxy.cs /config:MyServiceProxy.config

I get the following error:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot read ..\ws-addressing\*.xsd.

    Cannot load file D:\Documents\DEV\SARPilot\Docs\eoschema\schema\ws-addressing\ws-addr.xsd as an Assembly. Check the FusionLogs
 for more Information.

    Could not load file or assembly 'file:///D:\Documents\DEV\SARPilot\Docs\eoschema\schema\ws-addressing\ws-addr.xsd' or one of i
ts dependencies. The module was expected to contain an assembly manifest.

If you would like more help, type "svcutil /?"

I'm using the following schema files: http://wiki.services.eoportal.org/tiki-download_wiki_attachment.php?attId=637&page=HMA-FO%20Deliverables

How can i get past this error?

回答1:

Okay, so i've gotten past this error. (i get more now, but those are for another question).

I opened the ws-addr.xsd file in VS2010 and looked down the warnings list. one said:

Warning 105 The XML editor tried to convert this DTD to XSD so it can provide validation and intellisense while you type, but it could not create a valid XSD schema. Perhaps this DTD uses constructs that do not map to XSD. You may be able to get more information about the problem by using the Create Schema command. D:\Documents\DEV\SARPilot\Docs\eoschema\schema\ws-addressing\ws-addr.xsd 3 11 D:...\schema\

So i man went to "http://www.w3.org/2005/08/addressing/ws-addr.xsd" and downloaded the correct one and replaced it.

I no longer got the warning 105, and no longer get the "Could not load file" error with svcutil