Skip to main content

Solution Lifecycle Management - Solution Layering Experiments

By Betim Beja ·

TL;DR; This is a technical article for Dynamics CRM Consultants/Developers sharing my thoughts.

Microsoft released the Solution Lifecycle Management whitepaper on January 25th, which describes how Dynamics 365 solutions should be "Managed".

It appears that the most complicated concept to understand in this document is Solution Layering. I did some experiments to test the behavior of the system in relation to the Solution Layering concept which I want to share in this article.

I have created three trial environments to make my tests. Two of those environments are used as "Development" environments and the third is used as "UAT" or "Production" environment, which for our purpose are equivalent.

I have created a solution which introduces a new entity Layer (bb_layer) with the Name (bb_name) field which has a length of 100. (Note: Development environment 1 was used)

New entity form in development environment 1 creating the Layer entity (bb_layer) in Solution 1
Primary Field tab of the Layer entity defining the Name field (bb_name) with a maximum length of 100

And I exported solution Layer 1 (v1.0.0) as a managed solution.

Export Solution dialog for Solution 1 with the Managed package type selected

At this point to truly benefit from solution layering I imported the managed solution into the other development environment.

Import Solution wizard in development environment 2 with Solution1_1_0_0_managed.zip selected
Import wizard solution information showing Solution 1 as a managed package from publisher Betim Beja

On the second development environment I created a new solution, Solution 2, where I amended the length of the name attribute of Layer entity from 100 to 150. And we export the solution as a managed solution.

So at this point I have the first development environment with one unmanaged solution, Solution 1...

Solutions list in development environment 1 with Solution 1 v1.0.0 installed as unmanaged

... and the second development environment which has one managed solution, Solution 1, and one unmanaged solution, Solution 2, which has a dependency on Solution 1.

Solutions list in development environment 2 with unmanaged Solution 2 and managed Solution 1 v1.0.0

On the first development environment we clone Solution 1 (and make it v1.1.0) and there we change the length of Name attribute of Layer entity from 100 to 120...

Name field of the Layer entity in the cloned Solution 1.1 with the maximum length changed to 120

... and also add a new attribute called New Field (bb_NewField) with a length of 100.

New Field (bb_NewField) added to the Layer entity in Solution 1.1 with a maximum length of 100

We then export the update as a manged solution. We first try the layering in the second development environment by importing the updated Solution 1 (v1.1.0).

Import wizard in development environment 2 detecting an update of Solution 1 from v1.0.0 to v1.1.0

Normally we don't override the changes as this is a development environment.

Import options for the Solution 1 update with 'Maintain customizations (recommended)' selected

And we can see that the new attribute has been added to the Entity

Layer entity fields in development environment 2 showing the newly imported bb_newfield as managed

and that the length of the Name field has not changed from 150 (Solution 2, unmanaged) to 120 (Solution 1 update v.1.1.0) because the unmanaged customizations are all in the top layer.

Name field in development environment 2 still showing a maximum length of 150 after the Solution 1 update

Now lets import everything in the production environment and test how the Solution Layering works. Note that Microsoft suggests we only use managed solutions in our production environments, so that the system can have a predictable behavior. Also if the solutions should only include changes they apply and not include the dependencies so we can have some more validation on the order of import. For example if we try importing Solution 2 before Solution 1 we get an missing dependency error.

Import of Solution 2 into production failing because the Layer entity from Solution 1 (1.0.0) is missing

If we import the solutions in the following order, Solution 1 (v1.0.0), Solution 2(v.1.0.0) and then Solution (v1.1.0) and we choose to maintain customizations we can verify that the length of the Name field is 150 (from Solution 2) and not 120 (from Solution 1 v1.1.0).

Layer entity in production showing the Name field with a maximum length of 150 after maintaining customizations

Please note that choosing override customizations...

Import options in production for the Solution 1 update with 'Overwrite customizations' selected

... produces unexpected results. The end result is that the Solution 1 update is being applied as a new layer on top of other customizations.

Layer entity in production showing the Name field length reverted to 120 after overwriting customizations

I hope this example helps reduce the complexity of the Solution Layering concept.