asp.net-mvcjson.netsharp-architecture

Sharp Architecture - NewtonSoft.Json assembly mismatch


  1. Create a fresh Sharp Architecture project.
  2. Successfully build, create DB, run Web app.
  3. Attempt to add a new entity to the database via the web View.
  4. Get the error:

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.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)


Solution

  • Issue:

    The Newtonsoft.Json package was not updated due to the -Safe param added in the Sharp Architecture instructions

    Solution:

    1. Manually update the NewtonSoft.Json package via the Package Manager Console:

      Update-Package Newtonsoft.Json

    2. Update the binding references for each project that includes that package via the Package Manager Console:

      Add-BindingRedirect