我有一种情况,Docusign API引用RestSharp签名程序集,公钥标记为598062e77f915f75。在同一个项目中,我使用的是Twilio API,它也引用了未签名的Restsharp程序集,显然是使用了一个空的公钥令牌。
我可以同时创建一个或另一个但不能同时工作,因为我不能同时添加有符号和无符号的RestSharp引用,因为它们都具有相同的名称。
当我有一个对已签名的程序集的引用时,Docusign部分可以工作,但Twilio代码错误:
Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
当我引用无符号装配时,Docusign会出错:
Could not load file or assembly 'RestSharp, Version=100.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
这有什么办法吗?
我尝试过在我能想到的每个组合中绑定重定向:
<dependentAssembly>
<assemblyIdentity name="RestSharp" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="105.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-100.0.0.0" newVersion="105.2.3.0" />
</dependentAssembly>
答案 0 :(得分:0)
我可以想到几种可能的方法来解决这个问题:
ildasm
我曾经遇到类似问题,我们的项目和第三方库引用了不同的log4net版本。这是blog post。
答案 1 :(得分:0)
我遇到了同样的问题。我使用了RestSharpSigned的Nuget包。这解决了我的问题。
答案 2 :(得分:-1)
尝试将每个版本重定向到当前版本到最新安装版本:
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-105.2.3.0" newVersion="105.2.3.0" />
</dependentAssembly>