0

I am trying to map RestSharp 105.2.3.0 to RestSharp 106.5.4.0 using assembly binding, but it fails.

<dependentAssembly>
    <assemblyIdentity name="RestSharp" publicKeyToken="null" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-106.5.4.0" newVersion="106.5.4.0" />
</dependentAssembly>

I am using the version from nuGet:

  <package id="RestSharp" version="106.5.4" targetFramework="net472" />

Log entries:

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL file:///C:ConsoleClient/bin/Debug/RestSharp.DLL.

WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user1255637
  • 111
  • 1
  • 9
  • https://stackoverflow.com/a/38834840/8695782 this sounds like it's related. – Alexandru Clonțea Dec 29 '20 at 21:06
  • I tried this code and it fails: – user1255637 Dec 29 '20 at 21:11
  • 1
    There is no real advantage to use RestSharp anymore. Id seriously consider using the more modern HttpClient via the IHttpClientFactory interface – TheGeneral Dec 29 '20 at 23:39
  • I am using a nuGet packages that references it. I could try to just add the project and change the reference, but I prefer the nuGet https://github.com/hubspot-net/HubSpot.NET – user1255637 Dec 30 '20 at 00:31
  • I found out that those versions of RestSharp have breaking changes. I downloaded the HubSpot.NET project and changed the reference. I stopped using the nuGet package. Assembly binding fails, when there are breaking changes. It is a best practice to just change assembly versions. – user1255637 Dec 30 '20 at 15:59

0 Answers0