gpt4 book ai didi

c# - 作为依赖项和不同的 publicKeyTokens 共享时的 RestSharp 错误

转载 作者:太空狗 更新时间:2023-10-29 17:51:40 28 4
gpt4 key购买 nike

使用来自 DocusignTwilioAuth0 的 API。所有 3 个都将 RestSharp.dll 作为依赖项。

如果我使用 Docusign 包中包含的 RestSharp.dllDocusign 运行良好,但 Auth0Twillio 给出错误:

Could not load file or assembly 'RestSharp, Version=104.1.0.0, Culture=neutral, PublicKeyToken=null'

如果我使用普通的 RestSharp.dll (Install-Package RestSharp),TwilioAuth0 工作正常,但我在使用文档签名:

Could not load file or assembly 'RestSharp, Version=100.0.0.0, Culture=neutral, PublicKeyToken=5xxxxxxxxxxxx'

添加绑定(bind)重定向并不能解决问题。没有绑定(bind)重定向,我在日志中收到此错误:

Comparing the assembly name resulted in the mismatch: MAJOR VERSION.

如果我使用绑定(bind)重定向:

Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN.

绑定(bind)重定向代码:

<dependentAssembly>
<assemblyIdentity name="RestSharp" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-105.2.3.0" newVersion="105.2.3.0" />
</dependentAssembly>

最佳答案

通过将 Docusign 包中包含的 RestSharp.dll 重命名为“RestSharpDocusign.dll”并将其复制到我的项目中,暂时解决了这个问题。

我修改了程序集绑定(bind),以便在调用版本 100.0.0.0 时加载特殊的“RestSharpDocusign.dll”以及所需的 publicKeyToken Docusign。其他任何东西都会使用带有空 publicKeyToken 的标准 RestSharp.dll。

<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="100.0.0.1-105.2.3.0" newVersion="105.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<codeBase version="100.0.0.0" href="ult/RestSharpDocusign.dll" />
</dependentAssembly>

关于c# - 作为依赖项和不同的 publicKeyTokens 共享时的 RestSharp 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38834155/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com