'Upgrade an Unmanaged Solution

We are having a problem where importing an Unmanaged Solution from a packaged Git repository is not removing components.

We have multiple devs working on the same solution: each dev is using their own developer environment, and has an Azure DevOps pipeline set up to export and import the solution to and from a branch in git. This allows for us to user pull requests into the main branch, which then automatically imports the solution into our common Development environment.

This needs to be an unmanaged solution: you cannot package a git repository that was exported as Unmanaged and then Import it elsewhere as managed. To create a Managed solution, we need to export an unmanaged solution as managed in the first place (which is then imported into UAT, production, etc)

However, we've noticed something odd happening in the 'import Unmanaged Solution' step: if any of us has removed a component in our dev environment, when merging main in we see the relative XML shown as deleted in the file-diff. However, when the import step happens, the deleted component remains in the imported environment.

Power Apps Docs suggest why. In particular, it states:

Update This option replaces your solution with this version. Components that are not in the newer solution won't be deleted and will remain in the system (emphasis added). This option is not recommended as your destination environment will differ in configuration from your source environment and could cause issues that are difficult to reproduce and diagnose.

On the other hand, it also suggests that upgrade would have the effect we seek.

Upgrade This is the default option and upgrades your solution to the latest version and rolls up all previous patches in one step. Any components associated to the previous solution version that are not in the newer solution version will be deleted. This is the recommended option as it will ensure that your resulting configuration state is consistent with the importing solution including removal of components that are no longer part of the solution.

However, I can't find a way of Upgrading an unmanaged solution, especially through the Power Platform Tools in an Azure DevOps pipeline

Below are the options that show up in the Azure DevOps 'Import Solution' task Azure Import Solution options

I have tried the 'Import as a Holding Solution' which to me implies the third action option "Stage for Upgrade". When doing so, I received an error stating that you cannot stage unmanaged solutions. I also would have thought that 'Overwrite unmanged customizations' would explicitly handle this (although I am now under the impression it only matters for managed solutions too).

Is there a way to Upgrade an unmanaged solution, and if so, can it be done from an Azure DevOps Pipeline?



Solution 1:[1]

Unmanaged solutions can only modify existing components and add new components to a target environment. When an unmanaged solution is removed, all components that came with it remain in the environment. This is how it always have worked.

For unmanaged the upgrade process only means that components that have been transferred by a holding solution will be added to a main solution. Still, nothing is removed from the system.

When you need to remove unmanaged components, you will have to do that by hand or by means of custom tooling.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Henk van Boeijen