Can't install a managed solution when it was previously deployed as unmanaged
Applies to: Power Platform, Solutions
This article provides a workaround for an issue that occurs when importing a managed solution that includes components that already exist in an unmanaged state in Microsoft Power Apps.
Symptoms
You see the following errors when installing a managed solution:
-
Microsoft.Crm. Tools.ImportExportPublish.ImportSolutionException: Solution manifest import: FAILURE: The solution is already installed on this system as an unmanaged solution and the package supplied is attempting to install it in managed mode. Import can only update solutions when the modes match. Uninstall the current solution and try again.
-
Microsoft.Crm.CrmException: A managed solution cannot overwrite the [Component Name] component with Id=[Component ID] which has an unmanaged base instance. The most likely scenario for this error is that an unmanaged solution has installed a new unmanaged [Component Name] component on the target system, and now a managed solution from the same publisher is trying to install that same [Component Name] component as managed. This will cause an invalid layering of solutions on the target system and is not allowed.
-
Microsoft.Crm.CrmException: The import has failed because the system cannot transition the entity form [Form ID] from unmanaged to managed. Add at least one full (root) component to the managed solution, and then try to import it again.
Cause
This behavior is by design. You can't install a managed solution when the following are true:
- A component of the managed solution already exists as part of an unmanaged solution in the target environment.
- The solution has been previously installed as an unmanaged solution, or the managed solution was exported from an unmanaged solution in the target environment.
Some solution components don't support automatic conversion of unmanaged to managed state without setting the ConvertToManaged
property.
Workaround
To successfully convert the unmanaged component to a managed state, use one of the following workarounds:
- Delete the unmanaged component and import the solution again.
- Import the solution with the convert to managed option applied. There are several ways to import a solution using this setting:
- Use the Microsoft Power Platform CLI pac solution import command with the convert-to-managed flag set.
- Use the Dataverse SDK for .NET ImportSolutionRequest class to set the ConvertToManaged property to
true
. - Use the Dataverse Web API ImportSolution action with the
ConvertToManaged
parameter set totrue
. - Use the Power Platform Import Solution build task with the
ConvertToManaged
parameter set totrue
.