0

After adding a reference to 3d party I started keep getting an error: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

In my proj file I'm using 13 version.

<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

Locally I fixed this error with: Update-Package –reinstall Newtonsoft.Json

On Azure-Devops CI Nuget restore step look like this: enter image description here

On Job log is see that this package is restoring:

Restoring NuGet package Newtonsoft.Json.13.0.1

I tried Disable local cache option, it doesn't work.

How I should specify this step to force reinstall nuget package?

Nicolas
  • 74
  • 11
  • How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue? – Leo Liu Mar 17 '22 at 08:15
  • Yes, bindingRedirect on config and restore on DevOps Pipline resolved this issue. Marked as resolved. Thank you. – Nicolas Mar 17 '22 at 15:43

1 Answers1

1

This issue is typically fixed by defining bindingRedirect in your web.config (or app.config) file(s).

Please check this question here.