是否可以将签名的RestSharp NuGet软件包与Twilio一起使用? [英] Is it possible to use the signed RestSharp NuGet package with Twilio?

查看:33
本文介绍了是否可以将签名的RestSharp NuGet软件包与Twilio一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们同时使用了DocuSign的API(需要RestSharp的签名版本),并且我们正在寻求集成Twilio(它需要未签名的版本).我花了一些时间尝试使两个DLL都能够解决它们的每个依赖关系,而且还没有碰到任何运气.在这一点上,我希望有一种方法可以将签名的RestSharp dll与Twilio一起使用.以前有没有人有任何经验?

当我尝试删除未签名的RestSharp时,我的DocuSign代码可以正常工作,但是现在TwilioRestClient无法解析依赖关系.这两个库都是105.2.3.0.

Twilio.Api.dll中发生了'System.IO.FileLoadException'类型的异常,但未在用户代码中处理.

其他信息:无法加载文件或程序集'RestSharp,版本= 105.2.3.0,文化=中性,公钥令牌=空'或其中之一依赖关系.找到的程序集的清单定义不匹配程序集参考.(来自HRESULT的异常:0x80131040)

解决方案

对我来说,这是一个噩梦.就我而言,我使用的是EasyPost,后者使用的是RestSharpSigned.相同.

我最终不得不停止直接依赖nuget来引用RestSharp的软件包.并使用了一种工具来为第3方dll添加强大的命名功能.它还将对未签名的dll的引用修复为新签名的dll.

  1. 我将所有DLL从/packages/(easypost,twilio,restsharp)复制到了我的解决方案根目录下的目录中,该目录称为资源".这些最终将签入您的源代码管理中.

  2. 在桌面上复制资源目录.如果出现问题,您希望有一种快速的方法来重新复制一组未修改的新文件.

  3. 右键单击解决方案,然后单击管理解决方案的nuget程序包".删除Twilio,EasyPost,Restsharp,RestSharpSigned以及所有依赖RestSharp且现在具有资源副本的nuget程序包.当您这样做时,记下您的哪个项目引用了哪些程序集.这对于以后很重要.注意:从所有项目中删除该软件包都会删除引用.

  4. 下载

    We're using both DocuSign's API which requires the signed version of RestSharp, and we're looking to integrate Twilio which requires the unsigned version. I've spent a bit of time trying to get both DLLs to resolve for each of their dependencies, and haven't had any luck. At this point, I'm hoping there's a way to use the signed RestSharp dll with Twilio. Has anyone had any experience with this before?

    When I attempt to remove the unsigned RestSharp, my DocuSign code works fine, but now TwilioRestClient is unable to resolve the dependencies. Both libraries are 105.2.3.0.

    An exception of type 'System.IO.FileLoadException' occurred in Twilio.Api.dll but was not handled in user code.

    Additional information: 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)

    解决方案

    This is issue has been a nightmare for me. In my case I was using EasyPost which used RestSharpSigned. Same difference.

    I ultimately had to stop relying directly on nuget for packages that referenced RestSharp. And used a tool to add a strong naming to 3rd party dlls. It also fixes reference to unsigned dlls to the newly signed ones.

    1. I copied all the DLLs from /packages/ (easypost, twilio, restsharp) into a directory in the root of my solution called "resources". These will eventually be checked in to your source control.

    2. Make a copy of the resources directory on your desktop. If something screws up you want to have a quick way to recopy a fresh set of untouched files.

    3. Right click on the solution and hit "manage nuget packages for the solution". Remove the nuget packages for Twilio, EasyPost, Restsharp, RestSharpSigned, and anything that relies on RestSharp and now has a copy in resources. As you do this, make a note of which of your projects referenced which assemblies. This is important for later. Note: removing the package from all projects will delete the reference.

    4. Download Brutal Developer's Strong Namer Signer. Add all the dlls in /resources/ via the green plus icon. It is ok if some of them are already signed.

    5. Hit "Sign Assemblies", it will sign all unsigned assemblies and will fix the references between them to point at the newly signed versions.

    6. Go through your projects and add direct dll references.

    7. Build and run your app to ensure you don't hit any weird runtime errors about missing assemblies.

    8. In a raised voice, shout "Fucking Finally!" in triumph. Shake your Fist at the .Net Gods in the sky for all the trouble strong naming has caused you and millions of other devs.

    Ultimately, my plan is to migrate to the latest version of Twilio (5.*) which no longer has a dependency on RestSharp at all. Once that happens, I'm going to kill my "references" folder and just go back to plain ole nuget for these packages.

    这篇关于是否可以将签名的RestSharp NuGet软件包与Twilio一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆