I am having some trouble understanding this issue.
I have a local project with Twilio added via Nuget. But when I export the project to my IIS server, it cannot use Twilio, even if i have added all the DLL files for Twilio.
I think I am missing something with the include or something..
This is the errormessage i get:
Exception information:
Exception type: FileNotFoundException
Exception message: Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at Twilio.TwilioClient..ctor(String accountSid, String authToken, String accountResourceSid, String apiVersion, String baseUrl)
at Twilio.TwilioRestClient..ctor(String accountSid, String authToken, String accountResourceSid) in C:\projects\twilio-csharp\src\Twilio.Api\Core.cs:line 182
at Modules.Messaging.TwilioClient.Send()
Getting error because Assembly (DLL) of 'RestSharp' Version=105.2.3.0 is not available in your solution. You can check in Project -> references in VS. In some case, RestSharp Assembly available but of different version. In that case, First Right Click "Remove" older Assembly.
Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception: Could not load file or assembly ‘ [assemblyname]’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
Exception information: Exception type: FileNotFoundException Exception message: Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
RestSharp is external assembly, plugin registration takes on one assembly at a time. If you are on CRM on Premise you can add RestSharp Assembly in GAC or you need to merge RestSharp assembly with your plugin assembly. Add MSBuild.ILMerge.Task nuget package from nuget package manager into your plugin project.
I had the same issue, and I've finally found how to solve it.
The thing is: when you install Twilio
through NuGet, it installs RestSharp
as a dependency. BUT for some reason, the installed version of RestSharp
is Version=105.2.2.0
(instead of Version=105.2.3.0
, which Twilio
seems to be looking for at runtime).
So how do you solve that?
RestSharp
Why the NuGet Twilio bundle installs RestSharp Version=105.2.2.0
and then at runtime looks for RestSharp Version=105.2.3.0
? No idea.
Remove all references form Restsharp.
Clean Solution (Clean solution option)
Add RestSharpSigned.105.2.3 (find by name RestSharpSigned).
it's work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With