向 VS 添加 WSDL 服务引用失败,因为生成的 xsd 文件包含 TFS 的非法字符 [英] Adding WSDL service reference to VS fail because generated xsd file contains illegal character for TFS

查看:16
本文介绍了向 VS 添加 WSDL 服务引用失败,因为生成的 xsd 文件包含 TFS 的非法字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 TFS 的解决方案.我正在尝试添加一个 WSDL 作为对它的服务引用.

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

WSDL 的 URL 如下所示:.../ws/soap;auth=..."

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

添加引用时,VS 会生成所有需要的 xsd 文件,xsd 文件名将使用 URL 作为其名称.生成时,TFS会尝试自动添加文件,此时会检测到我有一个带有非法字符;"的.xsd文件.就像它的名字一样,然后整个服务引用生成就失败并停止了.

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.

我尝试将 wsdl 添加到未绑定到 TFS 的解决方案中,并且效果很好.

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

有什么解决方法吗?如果生成的 xsd 包含 TFS 不接受的非法字符,如何将 wsdl 作为服务引用添加到我的解决方案中?

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?

推荐答案

您可以使用 svcutil 生成代理类,svcutil 是一种 .NET 工具,可从网络位置上的 Web 服务或从 WSDL 文件中检索元数据,并且生成一个 WCF 类,其中包含访问 Web 服务操作的客户端代理方法.

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.

你可以在VS的命令行界面上使用这个工具:在此处输入图片描述

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

执行上面的命令会在D盘上生成一个代理类和配置文件,然后将这两个文件添加到你的项目中:在此处输入图片描述

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

这是关于 svcutil 的链接:

Here's a link about svcutil:

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

这篇关于向 VS 添加 WSDL 服务引用失败,因为生成的 xsd 文件包含 TFS 的非法字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆