Dynamics CRM 2016 Enhancement- Solution Patching
As we already know concept of solution was introduced in Dynamics CRM 2011, in Dynamics CRM 2015 there was cosmetic changes made in solution management. In this release they added significant improvements to manage solutions in better and deeper way.
Earlier versions if you wanted to export any field or any new specific customization of an entity you had to export entire entity itself.
If we export the solution, the entity and all customizations and related components like views, relationships, Ribbon, UI changes and any other components that are part of the entity are exported in that solution. Importing entity means deploying all customization to target environment. Sometime we want to avoid this but it was not possible in earlier versions.
In Dynamics CRM 2015 there was no enhancement in Solution framework but in Dynamics CRM 2016 Solutions and customizations are more manageable.
In Dynamics CRM 2016 we can include specific components in solution instead of including all entity assets as shown in picture below:
I will give a real time example that we face challenges every time. Suppose we deployed some solution to production. Sometimes, due to last minute change requests or emergency fixes need to push to UAT or Production environment right after deployment. We are already working on some enhancement in DEV and in between we did Emergency fix to CRM Form or fields and created new fields. In this scenario we just want to deploy emergency fixes that we did for form or created new field or modified anything in field or any change to a particular form for particular entity that is already deployed to production. We don’t want to deploy other enhancements that are still under development. We just want to deploy the Hotfix (patch).
In this scenario Dynamics CRM 2016 solution patching made it easier!
To address this, you can create and publish solution patches on top of existing solution that contains subcomponents of entities.
I will explain how solution patching works here:
I have created a MyTestPathEntity Entity and added to solution MyEntity.
Now I will create a patch for solution. You can select a solution and click Clone a Patch button. See in below screen shot You can change the display name and build numbers of the solution. You can’t change the Major and Minor versions.
It will create a solution Patch like below. It will be a blank solution without any component.
When you will try to edit the Parent solution it will show below message.
In Patch solution I have just added my custom field.
Field name is new_testoptionset.
Field is of type OptionSet.
I have added one more OptionSet value to existing OptionSet.
Now as Parent solution is already available in target environment you can just import Patch solution.
Solution should be deployed to target environment in below order.
- Parent solution
- Patch Solution
You can’t deploy Patch solution before Parent solution. You might be thinking how CRM is checking the dependency.
Patches are stored in the CRM database as Solution table. ParentSolutionId attribute indicates that the solution is a patch. Patch solution will be having reference to Parent solution.
If you have more than 1 patch. You should deploy in the order you have created.
If you want to merge parent solution and all patches you can clone solution. It will create an incremented version of solution and merge patches into the new solution. When you will click Clone solution button you can see below screen. You can modify Major minor version but you can’t modify Build and revision number.
Now after clone I can see only 1 solution with incremented version.
Few important things to remember as per the MSDN.
- Patches can only be created from a parent solution.
- The patch parent can’t be a patch. It won’t allow you to create a Patch from Patch.
- Patches can only have one parent solution.
- A patch creates a dependency (at the solution level) on its parent solution.
- You can only install a patch if the parent solution is present.
- A patch version must have the same major and minor number, but a higher build and release number, than the parent solution version number. The display name can be different.
- If a solution has patches, subsequent patches must have a numerically higher version number than any existing patch for that solution.
- Patches support the same operations as solutions, such as additive update, but not removal. You cannot remove components from a solution using a patch.
- Patches exported as managed must be imported on top of a managed parent solution. The rule is that patch protection (managed or unmanaged) must match its parent.
- Don’t use unmanaged patches for production purposes.
- Patches are only supported in CRM organizations of version 8.0 or later.
We would love to hear your feedback.
Adisys Engineering Team