I am currently in the process of upgrading one of our customer's solutions from Sitecore 8.1 Update-1 to Sitecore 9.0 Update-2. After running the Update Installation Wizard I discovered that the order of most of the renderings on page items had changed in comparison to Sitecore 8.1. Beforehand we already tested an upgrade with Sitecore 9.0 Update-1 for this solution and it worked perfectly fine there. This implied that something must have changed between Sitecore 9 Update-1 and Update-2. After some time I found this helpful article in the Sitecore knowledge base which explains this behaviour (previously only covered Sitecore 8.2 Update-7). Turns out that Sitecore has changed the parsing logic of the layout information.

I checked the release dates of all the previous Sitecore versions and I think that you will run into this problem if you want to upgrade from one of the following versions:

  • All versions prior to Sitecore 8.1
  • Sitecore 8.1 Initial Release
  • Sitecore 8.1 Update-1

In order to fix this problem you have to perform the following steps:

Update 15.02.2019: The gist has been updated due to a bug. The script automatically created an item version in the context language (most likely "en") when the shared layout field was modified.

  1. Backup the affected database(s)
  2. Install a clean instance of Sitecore 8.1 Update-2.
    The easiest way to do this is to use SIM.
  3. Change the connection strings of your clean solution to point to the affected database(s).
  4. Copy the admin page below to your clean solution
  5. Change the setting Query.MaxItems to a high value which should be higher than the amount of page items you need to migrate (e.g. 10000)
  6. Run the script with the according parameters
    (e.g. /sitecore/admin/MigrateLayouts.aspx?database=master&itemId={0DE95AE4-41AB-4D01-9EB0-67441B7C2450}&enableRecursion=true)