user3603110
user3603110

Reputation: 169

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

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"}

Upvotes: 0

Views: 968

Answers (1)

PraiseTheBaud
PraiseTheBaud

Reputation: 90

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://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions

Upvotes: 1

Related Questions