[英]Strong named assembly alongside unsigned assembly
I have a situation where Docusign API is referencing the RestSharp signed assembly with a public key token of 598062e77f915f75. 我有一种情况,Docusign API引用RestSharp签名程序集,公钥标记为598062e77f915f75。 In the same project I am using the Twilio API which also references the unsigned Restsharp assembly, obviously with a null public key token.
在同一个项目中,我使用的是Twilio API,它也引用了未签名的Restsharp程序集,显然是使用了一个空的公钥令牌。
I can make one or the other work but not both at the same time since I can't add both the signed and unsigned RestSharp references since they both have the same name. 我可以同时进行一个或另一个工作,但不能同时进行,因为我不能同时添加有符号和无符号的RestSharp引用,因为它们都具有相同的名称。
When I have a reference to the signed assembly, the Docusign part works but the Twilio code errors with this: 当我有一个对已签名的程序集的引用时,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)
When I reference the unsigned assembly, Docusign errors with this: 当我引用无符号程序集时,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)
Is there any way around this? 有没有办法解决?
I have tried binding redirects in every combination I can think of: 我已经尝试过在我能想到的每种组合中绑定重定向:
<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>
I can think of few possible ways to solve this issue: 我可以想到几种可能的方法来解决这个问题:
ildasm
. ildasm
使用一个键对组件进行签名/取消签名 。 I once had similar issue with different log4net versions being referenced by our project and 3rd party library. 我曾经遇到类似的问题,我们的项目和第三方库引用了不同的log4net版本。 Here is a blog post .
这是一篇博文 。
I was facing the same issue. 我面临同样的问题。 I have used the Nuget package of RestSharpSigned.
我使用了RestSharpSigned的Nuget包。 This resolved my issue.
这解决了我的问题。
Try to redirect every version up to the current to the latest installed version: 尝试将每个版本重定向到当前版本到最新安装版本:
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-105.2.3.0" newVersion="105.2.3.0" />
</dependentAssembly>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.