首页 > 解决方案 > VB .NET 上的 Salesforce Soap API:属性不能多次应用

问题描述

我正在使用 Visual Studio 2019 制作 VB .NET 来制作适用于 Windows 的 WPF 应用程序。我正在尝试使用 Salesforce SOAP api 从中获取数据。在解决方案资源管理器中,我右键单击我的项目 -> 添加 -> 服务参考 -> 高级 -> 添加 Web 参考。我输入了从 Salesforce 下载的企业 WSDL 文件的链接。在我的项目中,我有一个简单的测试按钮设置,运行它来尝试登录:

    Dim SFService = New SFAPI.SforceService
    Dim loginResult = New SFAPI.LoginResult

    loginResult = SFService.login(userID, userPass)

我的问题是我收到一些错误,指出自动生成的References.vb有错误,它们如下:

Error   BC30663 Attribute 'GeneratedCodeAttribute' cannot be applied multiple times.
Error   BC30663 Attribute 'SerializableAttribute' cannot be applied multiple times.
Error   BC30663 Attribute 'DebuggerStepThroughAttribute' cannot be applied multiple times.
Error   BC30663 Attribute 'DesignerCategoryAttribute' cannot be applied multiple times.
Error   BC30663 Attribute 'XmlTypeAttribute' cannot be applied multiple times.
Warning     Custom tool warning: Schema could not be validated. Class generation may fail or may produce incorrect results
Warning     Custom tool warning: Schema validation error: Schema item 'simpleType' named 'FaultCode' from namespace 'urn:fault.enterprise.soap.sforce.com' is invalid. The Enumeration constraining facet is invalid - 'fns' is an undeclared prefix.   
Warning     Custom tool warning: Schema validation error: Schema item 'simpleType' named 'FaultCode' from namespace 'urn:fault.enterprise.soap.sforce.com' is invalid. The Enumeration constraining facet is invalid - 'fns' is an undeclared prefix.

任何帮助将不胜感激。谢谢!!

标签: vb.netsoapsalesforce

解决方案


如果您遇到与应用两次的属性相关的错误,这通常意味着某处存在重复的 vb 文件。最好的办法是点击解决方案资源管理器中的图标以显示所有文件:不要骗我按钮. 可能有一个文件被隐藏/导致此处重复。

最终,编译器会看到重复的属性,这是失败的,除非您明确允许重复的属性。


推荐阅读