How to get around RestSharp "A strongly-named assembly is required"

0

I am using RestSharp for a Dynamics plugin, this requires the project to be a DLL. I get this error message when running the plugin:

An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): pluginname.PluginEntryPoint: System.IO.FileLoadException: Could not load file or assembly 'RestSharp, Version=105.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044) If you contact support, please provide the technical details

My code is using .NET Framework 4.6.2 and the RestSharp version is 106.6.10

This is the code I am trying to run:

var body = " {\"data\": [{ \"name\": " + name + ", \"parent_id\": \"0\", \"short_code\": " + shortcode + ", \"billable\": \"yes\",  \"assigned_to_all\": \"yes\", \"billable_rate\": \"37.50\"}]}";
var client = new RestClient("https://rest.tsheets.com/api/v1/jobcodes");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");//authorisation token
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
return true;

How can I get around this?

c#
rest
plugins
microsoft-dynamics
restsharp
asked on Stack Overflow Sep 25, 2019 by Joe BW • edited Sep 25, 2019 by Prophet Lamb

1 Answer

0

In your app.config or web.config, find the row for RestSharp. Something like this:

<dependentAssembly>
    <assemblyIdentity name="Resrsharp.." publicKeyToken="35bf3856bd364e31" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>

Check the version numbers at this row and actual DLL version.

answered on Stack Overflow Sep 25, 2019 by emert117

User contributions licensed under CC BY-SA 3.0