Adding WSDL service reference to VS fail because generated xsd file contains illegal character for TFS

自闭症网瘾萝莉.ら 提交于 2021-02-15 07:54:10

问题


I have a solution that is on TFS. I'm trying to add a WSDL as service reference to it.

The WSDL's URL looks like this: ".../ws/soap;auth=..."

When adding the reference, VS will generate all the required xsd files and the xsd files name would use the URL as its name. When generating it, TFS will try to automatically add the files, and at this point it will detect that I have a .xsd files with illegal character ";" as its name and then the whole service reference generation just failed and stopped.

I have tried adding the wsdl to a solution that is not bound to TFS and it works just fine.

Any workaround? How do I add the wsdl as service reference to my solution if the generated xsd contains illegal character that TFS won't accept?


回答1:


You can use svcutil to generate proxy classes,svcutil is a .NET tool that retrieves metadata from a web service on a network location or from a WSDL file, and generates a WCF class containing client proxy methods that access the web service operations.

You can use this tool on the command-line interface of VS: enter image description here

Executing the above command will generate the a proxy class and configuration file on disk D.Then add these two files to your project: enter image description here

Here's a link about svcutil:

https://docs.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-svcutil-guide?tabs=dotnetsvcutil2x




回答2:


Can you try adding a new class to your project, and copy the contents from the generated proxy class file through svcutil (link below, just in case). This way, I believe, you would be able to bypass the illegal characters in XSD.

You would be able to generate proxy class through Visual Studio Command Prompt using SvcUtil command

HTH!



来源:https://stackoverflow.com/questions/61631400/adding-wsdl-service-reference-to-vs-fail-because-generated-xsd-file-contains-ill

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!