[英]RestSharp error when shared as a dependency and different publicKeyTokens
Using APIs from Docusign
, Twilio
and Auth0
. 使用来自Docusign
, Twilio
和Auth0
API。 All 3 have RestSharp.dll
as a dependency. 所有3个都将RestSharp.dll
作为依赖项。
If I use the RestSharp.dll
included with the Docusign
package, Docusign
works well but Auth0
and Twillio
give errors: 如果我使用RestSharp.dll
附带Docusign
包Docusign
效果很好,但Auth0
和Twillio
给出错误:
Could not load file or assembly 'RestSharp, Version=104.1.0.0, Culture=neutral, PublicKeyToken=null' 无法加载文件或程序集'RestSharp,Version = 104.1.0.0,Culture = neutral,PublicKeyToken = null'
If I use the normal RestSharp.dll
(Install-Package RestSharp), Twilio
and Auth0
work fine but I get an error when using Docusign: 如果我使用正常的RestSharp.dll
(Install-Package RestSharp), Twilio
和Auth0
工作正常,但在使用Docusign时出现错误:
Could not load file or assembly 'RestSharp, Version=100.0.0.0, Culture=neutral, PublicKeyToken=5xxxxxxxxxxxx' 无法加载文件或程序集'RestSharp,Version = 100.0.0.0,Culture = neutral,PublicKeyToken = 5xxxxxxxxxxxx'
Adding binding redirects does not solve the issue. 添加绑定重定向并不能解决问题。 Without binding redirects, I get this error in the log: 没有绑定重定向,我在日志中收到此错误:
Comparing the assembly name resulted in the mismatch: MAJOR VERSION. 比较程序集名称导致不匹配:MAJOR VERSION。
If I do use a binding redirect: 如果我使用绑定重定向:
Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN. 比较程序集名称导致不匹配:PUBLIC KEY TOKEN。
Binding redirect code: 绑定重定向代码:
<dependentAssembly>
<assemblyIdentity name="RestSharp" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-105.2.3.0" newVersion="105.2.3.0" />
</dependentAssembly>
Temporarily solved the issue by renaming the RestSharp.dll that was included with the Docusign package to "RestSharpDocusign.dll" and copied that into my project. 通过将Docusign程序包中包含的RestSharp.dll重命名为“RestSharpDocusign.dll”并将其复制到我的项目中,暂时解决了该问题。
I modified the assembly bindings so that when version 100.0.0.0 was called it would load the special "RestSharpDocusign.dll" with the publicKeyToken Docusign wanted. 我修改了程序集绑定,以便在调用版本100.0.0.0时,它将使用publicKeyToken Docusign加载特殊的“RestSharpDocusign.dll”。 Anything else would utilize the standard RestSharp.dll with a null publicKeyToken. 其他任何东西都会使用带有null 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.