Is it possible to use the signed RestSharp NuGet package with Twilio?

守給你的承諾、 提交于 2019-12-04 14:29:49

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!