Different version for RestSharp reference(106.10.1) in NuGet package & .Net MVC reference (105.2.3)

0

I have .Net MVC project using user defined NuGet package which has RestSharp version - 105.2.3, also same .Net MVC has reference to RestSharp version - 106.10.1

With this setup I am getting below error:

{"Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null"}

c#
.net
nuget
restsharp
asked on Stack Overflow May 4, 2020 by user3603110

1 Answer

1

I suspect you need to tell your program to use the newer version.

In my projects, I've added the following to my configs to resolve similar issues to what you're having (with Newtonsoft JSON):

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

See this post: Assembly Binding redirect: How and Why?

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

answered on Stack Overflow Jun 6, 2020 by PraiseTheBaud

User contributions licensed under CC BY-SA 3.0