NuGet packages version inconsistency in Sitecore Experience Commerce 10.0


Description

Starting or restarting the Commerce Engine might fail with an unhandled exception. The root cause of the issue is that the package dependencies are resolved with incompatible versions after restoring Sitecore Commerce NuGet packages. The following message can be found in the logs:

System.IO.FileLoadException: Could not load file or assembly 'Sitecore.Commerce.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Solution

To resolve the issue, modify the Sitecore.Commerce.Engine.csproj file as follows:

  1. Add the following packages:
    <PackageReference Include="Sitecore.Commerce.Plugin.ManagedLists" Version="6.0.*" />
    <PackageReference Include="Sitecore.Commerce.Plugin.Search" Version="6.0.*" />
    <PackageReference Include="Sitecore.Commerce.Plugin.Views" Version="6.0.*" />
  2. Clean the project.
  3. Rebuild the solution.
    Note: It is recommended that you clear NuGet caches:
    • In Visual Studio:
      1. On the menu bar, click Tools.
      2. In the Tools drop-down list, select Options.
      3. In the Options dialog box, search for and click NuGet Package Manager.
      4. In the NuGet Package Manager drop-down list, select General.
      5. Click the Clear All NuGet Cache(s) button.
    • By running the following command using the NuGet Command Line Interface, nuget.exe:
      nuget locals all -clear