Understanding D365 CE solution Deployment – Packaging – Part 2

In the previous post we created the new package template project and checked the default files which  are created in the solution.

In this solution, we need to add the exported solution(s) under package folder and if we have any configuration data files, that can also be added to this folder. Once we add these files, we have to set up the configuration file which guides the package deploy what is to be imported and how.

Setting up this file is one of the important task in creating the package. Let us  see in details

Refer to the below file which is modified by for this post.  This is an xml file and we have to mention the names of the added exported solution files and the data files etc here.

Myappconfigdata.zip is the data file and MyappSolution_1_0_managed.zip is the solution which is to be deployed .

<?xml version="1.0" encoding="utf-16"?>
<configdatastorage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <configsolutionfile solutionpackagefilename="MyappSolution_1_0_managed.zip"
    <cmtdatafile filename="Myappcongigdata.zip"
                 usermapfilename="" />


Microsoft docs has very detailed explanation about this config files and there is explanation about all the tags and its importance . Hence I am not going in those details again in this  post. Kindly refer to below link for more details.

Specify the configuration values for the package

We have to mention all the solutions under <solutions>  tag . Here for example I have added only single solutions, but we can add multiple solutions. The order we mention the solutions in this, solutions will be imported in the same order. We can specify whether we want to overwrite the existing customization while importing and also whether we want to publish the workflows and activate plugins post import using the attributes\

  • overwriteunmanagedcustomizations
  • publishworkflowsandactivateplugins

If we have the data file, that also can be mentioned here. This data file can be created with the  help of configuration migration tool provided by Microsoft. We will discuss this in detailed  this in later posts. Kindly refer the Microsoft Docs link for more details on this

Using Configuration Migration tool 

Now we let see thMyappSolutione use of PackageTemplate.cs which helps us to write the custom code for our deployment. To make it simple, let us keep the default code in this file except the properties . We have to set the properties as per the names we have given to our files and folders. It helps the deployer to identify the solution(s) to be imported and data to to migrated.

#region Properties

/// <summary>
/// Name of the Import Package to Use
/// </summary>
/// <param name="plural">if true, return plural version</param>
/// <returns></returns>
public override string GetNameOfImport(bool plural)
return "MyappSolution";

/// <summary>
/// Folder Name for the Package data. 
/// </summary>
public override string GetImportPackageDataFolderName
// WARNING this value directly correlates to the folder name in the Solution Explorer where the ImportConfig.xml and sub content is located. 
// Changing this name requires that you also change the correlating name in the Solution Explorer 
return "PkgFolder";

/// <summary>
/// Description of the package, used in the package selection UI
/// </summary>
public override string GetImportPackageDescriptionText
get { return "My App created for learning solution deployment "; }

/// <summary>
/// Long name of the Import Package. 
/// </summary>
public override string GetLongNameOfImport
get { return "MyApp Solution Package created for learning the solution deployment using package deployer "; }


Microsoft Docs has very intuitive explanation about this file’s usage and what to change. Kindly refer below link to go the more details

Define custom code for your package

Now its the last step. If you observe carefully, any installation starts with some welcome page with few information/ instructions and after the installation is complete, it gives some information/Thank you message etc. Same process applies here during package deployment as well and we can add such pages in html format and different languages. Inside the pkgfolder, we see a content folder and which has default html files for English language. we can customize those as per our requirement and required language

Kindly refer to Microsoft Docs site below about more details

Update the html files

Now our package is ready for build. Let us build the package and see in bin folder, we will see the one dll along with pkgfolder. As we have set the copy always for all the files in folder, it is copied in the bin folder.

We have come to the final step of deploying the package. Let us see the same in next post.

Continue reading “Understanding D365 CE solution Deployment – Packaging – Part 2”

Understanding D365 CE solution Deployment – Patches – Part 2

In previous post we saw how to  create a patch and deploy it to the target instance. We have completed four steps from below steps

  1. Create solution in source instance and export
  2. Import the solution in the target instance
  3. Create first patch in source instance and export the patch
  4. Import the first patch in target instance
  5. Create second patch in source instance and export
  6. Import the second patch in the target instance
  7. Delete the second patch from target instance
  8. Merge the patches to original solution in source instance
  9. Export the merged solution from source instance
  10. Import the merged solution in target instance (target solution has first patch already)

Let us continue the further steps and learn more.

5. Create second patch in source instance and export

To know more about patches, let us create a more patch on the same solution. Now let us change the Max length of description field and see how this would reflect in the target instance. I am not getting into all the details again as its same as previous steps of creating Patch. Only difference is we are creating second patch on the same solution. Hence create the patch and then export the same

6.  Import the second patch in the target instance

As we have above patch solution exported, let us import the same in the target instance. and check if the changes are reflected.

Here we can see the different solution layers as depicted in below snippet. As we have done changes in the description field in both the patches, we can check solution layers for the same field. Similarly we can check for other fields or components to understand when it was changed


As this field was customized twice, we can see one default solution by Microsoft and rest two are from publisher Vrushali 🙂 Patchtarget12

7.  Delete the second patch from target instance

Now let us delete the second patch from the target instance , we can see the original solution and the first patch remains unaltered. The changes from second patch will only be removed. I added this step as I wanted to show the upgrade functionality in the patch deployment, otherwise I had to create one more patch and explain. Hence a shortcut 🙂

8. Merge the patches to original solution in source instance

We have two patches in the source instance, now if we think its better to merge those to solution from ease of maintenance.  In this case we can use the  functionality of Clone to Solution. This functionality will merge all available patches to the solution and update the original solution with incremented major version as depicted in below snippets.

Select the Solution and click on Clone to Solution


We are allowed to  change the major version of the Solution and save. Once saved only single original solution with updated version number would be shown in the solution list.



9.  Export the cloned solution from source instance

Exporting the cloned solution from the source instance is the same process as we export any normal solution. Hence not going in details again.

10.  Import the merged solution in target instance (target solution has first patch already)

Let us import the exported solution into the destination instance. Here is the catch. We already have the original solution available in the target instance along with the first patch. We are trying to import the merged solution, the import will recognize that original solution is already there and will give you option to upgrade the existing solution with new solution updates or if you are not sure, you can keep new solution isolated from this .

Let us see step by step the specialty of importing the updated solution

As we  can see in below snippet, original solution and first patch already exist in the target instance, and we are importing the upgraded solution now which has first and second patch cloned in the original solution.


As soon as select the solution and click on next, the instance automatically detects that the solution package contains an update for a solution that is already installed and the same message is displayed on the top. Patchtarget14

Once we click on the next button, we see below options for the action to be taken

  • Upgrade : This is recommended action which upgrades the existing solution  to the latest version and rolls up all previous patches in one step. Any components which are removed in the to be imported solution will be deleted from the instance
  • Stage for Upgrade : This option also upgrades the existing solution to higher version, but unlike the above option, it defers the deletion of removed components , until we apply a solution upgrade later. Its like a a staging state and then you can apply actual changes later when you are comfortable
  • Update: This option  would not delete any removed component from the instance

We are selecting the stage for upgrade action here for learning purpose

Also we have the option to select the action on the previous customization on components included in the to be imported solution such as maintain the customization or overwrite the customization and click on Import button.


It will import the  new solution in the target instance Patchtarget16

Here again it will ask if we want to apply for upgrade by providing the button, but we are not clicking it now and going ahead.


As we see in below snippet, there are three solutions present at the moment, one is the original, then second is its patch and third one the staging solution as discussed above. Also notice the versions for these solutions.


Let us do apply the upgrade now by selecting the original solution and clicking on the Apply Solution Upgrade option from the the top


Now it will apply the upgrade Patchtarget20

Once the solution upgrade is completed, we can see the single  solution available in the target instance with the upgraded version as shown in below snippet.


This is how we have seen the complete patch deployment process in these posts.

I would recommend to do the hands on , follow the steps while going through the blog which will give more clarity.

Hope these posts help you in solution deployment and watch this space for further details on solution deployment using package deployer and Devops -Powershell scripts.

Happy deploying and patching  🙂

Continue reading “Understanding D365 CE solution Deployment – Patches – Part 2”