Solution segmentation has greatly improved since Dynamics CRM 2016. You are able to deploy small fixes to your production environment by the use of a patch solution. This reduces the risk of unintentionally modifying objects on the target deployment. More information and getting started with patch solutions can be found on msdn.

Unfortunately an important feature is missing with the use of patch solutions. More specifically, we have no option to “overwrite customizations” when deploying a managed patch solution.

When deploying a patch the user does not have the option to overwrite customizations.

This results in unmanaged customizations on the target deployment to never be overwritten.

Before having to abandon our release strategy of using patches, we tried to find a resolution to this limitation. Like any other managed solution, patches can be updated. Maybe the user would be requested to overwrite (or maintain) customizations while updating a patch?

So let’s re-deploy the same patch to our target environment. Now the user has the option to overwrite or maintain customizations. Great! Unfortunately not that great, as it just doesn’t seem to do the trick.

Updating an existing patch gives the user the option to overwrite customizations.

The import succeeds but no unmanaged customizations were overwritten. Clearly a bug here. Knowing we never had issues overwriting customizations while updating a ‘regular’ managed solution we presumed the glitch is related to the patch solution.

What if we could make the system believe the solution we are using to update our patch is not a patch but a ‘regular’ managed solution? Would it overwrite the customizations? Guess what, it does! How to convert a patch solution in a ‘regular’ managed solution and how this can overwrite your customizations is described below.

How to overwrite customizations when deploying a patch solution

  • Step 1: Deploy your managed patch (user is not given the choice to overwrite customizations).
  • Step 2: Modify the managed patch solution to a ‘regular’ managed solution by removing the <ParentUniqueName> node from the solution.xml.

    Removing the ParentUniqueName node from the patch solutions converts the solution to a regular solution.
  • Step 3: Import your modified patch solution and select overwrite customizations while doing so.

    Overwrite customizations of our modified patch does work as expected.
  • Step 4: Import your (original) managed patch solution again. Just to be on the safe side. Selecting overwrite customizations here is optional.

Unmanaged customizations were successfully overwritten, just what we needed. Hopefully Microsoft will address this issue sooner than later but in the meanwhile we can use this workaround.

One thought on “Overwrite customizations when deploying a patch solution”

Leave a Reply