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"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   installsampledata="true"
                   waitforsampledatatoinstall="true"
                   agentdesktopzipfile=""
                   agentdesktopexename=""
                   crmmigdataimportfile="Myappconfigdata.zip">
  <solutions>
    <configsolutionfile solutionpackagefilename="MyappSolution_1_0_managed.zip"
                        overwriteunmanagedcustomizations="false"
                        publishworkflowsandactivateplugins="true"/>
  </solutions>
 
  <cmtdatafiles>
    <cmtdatafile filename="Myappcongigdata.zip"
                 lcid="1033"
                 usermapfilename="" />

  </cmtdatafiles>
</configdatastorage>

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
{
get
{
// 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 "; }
}


#endregion

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 – Part 2

In previous post we discussed about various ways of solution deployment and the types of solutions. Let us see how we do it actually.

Here we are looking at the manual solution deployment

In the source instance, go to solutions

Solution Deployment 1

Click on Create new solution

Solution Deployment 2

Enter the details like display Name, Name, Publisher and version.

Solution Deployment 3

Either we can select existing publisher or create a new publisher. Publisher defines the prefix for the customization which  is “new_” by default and we can change based on our strategy. In case we are ISVs and want to distribute this solution to multiple clients, we can define the prefix as per our decision. Even in multi vendor implementations, different vendors can create separate publishers or use common as per client’s guidelines.

To create a new publisher, go to settings, Customization and click on Publishers

publisher

Click on New

publisher1

Enter the required details, importantly prefix and save and close.

publisher2

After selecting the publisher, enter other details about the solution

Solution Deployment 4

Once the solution is created, we can either add new components or existing components  and do the customization  Solution Deployment 5

Finally we need to publish all customizations Solution Deployment 6

After the publishing the customizations, now we can export the solution

Solution Deployment 6.PNG7

When we export the solution, it again asks for publishing, we can click on Next button

Solution Deployment 8

We can select the export settings as mentioned below and click on Next button

Solution Deployment 9

Here it asks if we want export Managed or Unmanaged.  Unmanaged is by default selected and we have  to explicitly select Managed and click on Next button

Solution Deployment 10

It will download the zip file of the exported managed solution. Now we need to open the destination instance. Go to Advanced settingsSolution Deployment 11

Go to solutions, click on import

Solution Deployment 12

Browse and select the recently downloaded file solution zip file

Solution Deployment 13

Click on nextSolution Deployment 14

It will show import successful message. In case there are any errors, we can download the log file and verify

Solution Deployment 15

We can check in the destination instance if our customization is getting reflected.

After basic solution deployment, let us see patch deployment in further post.

Happy deploying !!

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