Problem Statement:  

You have 2 managed solutions in a Dataverse environment and you would like to change/swap the solution layers.
Your initial state of the solution layering is like below: 

 Solution Layering Initial State

Warning: The steps described below is not meant to be used on a production environment directly. Apply these steps to your test environment first and make sure you achieve desired outcome before applying in any production environment.

Steps to follow:

  1. Start with a solution with no pending upgrades and no patches.
  2. Make a copy of the last version of the solution file they have imported (In this example this is Solution B)
  3. Edit the solution file and changes the unique name to something_holding. (Unzip the solution file, modify the solution.xml and zip the files back)
     Modify Solution Xml
  4. Import the holding solution file.  This will result in a new solution layer on top of the stack, and the existing solution will be left alone. Step 4 Import Holding Solution B
  5. Delete the original solution file (In this example this is Solution B).  Since the holding solution is there, no components or data will be deleted. Step 5 Delete Solution B
  6. Import the original solution file (In this example this is Solution B).  This will be a new solution and will be on the top of the stack for all components. Step 6 install original solution B
  7. Delete the holding solution file.
     Step 7 Delete Holding Solution

Variations of the steps can be for example: holding solution could become the solution – no need to delete and reimport the original solution (skip the steps 5, 6 and 7)

Warning: The steps described below is not meant to be used on a production environment directly. Apply these steps to your test environment first and make sure you achieve desired outcome before applying in any production environment.