将连接的服务添加到nuget包



我使用visualstudio创建了一个c#类库。这个库基本上只是访问soap API的助手类的容器。为了与soap API交互,我在visualstudio中添加了一个连接服务。

概括:myLibrary >HOLDS> helperClass >REFERENCES> Connected Service >CALLS> SOAP API

我之所以把helperClass放在库中,是因为我需要在另一个项目中使用此代码。(目的地项目是UiPath项目,仅供参考(

然后,我从这个库创建了一个nuget包,这就是我将它导入目标项目的方式。

因此,现在我有了一个可移植代码库,可以与soap API交互。但它不能,因为nuget包无法识别连接服务。

这是我在目标项目中创建helperClass实例时遇到的错误:

System.InvalidOperationException: Could not find default endpoint element that references
contract 'TMSDataService.TMSDataServiceSoap' in the ServiceModel client configuration
section. This might be because no configuration file was found for your application, or
because no endpoint element matching this contract could be found in the client element

我添加的nuget包最初只有.dll文件,但当我看到错误时,我添加了.dll.config文件。尽管如此,它仍然抛出了同样的错误。


我做了一些研究,想知道如何将我的连接服务添加到我的nuget包中。(←这是主要问题(

运气不太好之后,我决定不能真的把这项服务添加到我的nuget包中。我愿意为该服务创建一个新的nuget包,但我认为这也不可能。

我的最佳选择是什么?有没有办法使用nuget包中的服务?

将App.config添加到使用带有服务配置的nuget包的项目中。只需确保将文件配置为复制到构建目录即可。

最新更新