Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'RestSharp, Version=105.2.3.0

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()
like image 793
Thugge Avatar asked May 06 '16 05:05

Thugge


People also ask

How to get rid of getting error'restsharp Assembly not available'?

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.

Why am I getting ‘could not load file or assembly’ errors?

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.

What is filenotfoundexception in restsharp?

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.

How to add restsharp Assembly to a plugin?

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.


2 Answers

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?

  1. Go to your installed NuGet packages
  2. Select RestSharp
  3. Update it to the version 105.2.3.0 (with the blue-arrow icon)

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.

like image 134
Xavier Peña Avatar answered Oct 02 '22 17:10

Xavier Peña


  1. Remove all references form Restsharp.

  2. Clean Solution (Clean solution option)

  3. Add RestSharpSigned.105.2.3 (find by name RestSharpSigned).

    it's work.

like image 27
Norberto Castellanos Avatar answered Oct 02 '22 17:10

Norberto Castellanos