Deploy Packages Using Package Deployer Tool In Dynamics 365 CRM

Introduction

In Dynamics 365 CRM or Power Platform, under core tools category Package Deployer Tool enables users to deploy packages to a selected Dynamics CRM Environment which makes life easy by simply configuring one or more Dynamics / Dataverse solution files[CRM Customizations solution files], one or more Data Files (Data file extracted from Dynamics CRM Environment using Data Migration Utility), one or more CSV files (CSV files with a list of accounts/ contacts, etc ) without writing a single line of code and in few minutes changes can be deployed.

Step 1

First, we have to download Microsoft Dynamics CRM SDK Templates for Visual Studio that contains the package template by going into the following URL MicrosoftDynamicsCRMSDKTemplates [https://marketplace.visualstudio.com/items?itemName=DynamicsCRMPG.MicrosoftDynamicsCRMSDKTemplates] and download it as shown in the below figure,

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 2

After step 1, a vsix file will be downloaded with the name CRMSDKTemplates. Navigate to the folder where the above file was downloaded, double-click the CRMSDKTemplates.vsix file and it will take some time for installation as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 3

After step 2, a popup window will come and you can see message initializing which adds a template to Visual studio and automatically closes once the template is added to Visual Studio as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 4

After step 3, if the template is successfully added into Visual Studio then a CRM Package template will be added. Now Open Visual Studio and create a new project with the below navigation open Visual Studio and then go to Menu and select – File-> New -> Project which will open a new window to create a new project, and in the search box type CRM Package and then select CRM Package and then click on Next as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 5

After step 4, the user will be navigated to the next window and there give the project name and location to store as an example gave CRMPackageDeploymentTemplateSample and click on Create as shown in the below figure,

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 6

After step 5, a separate solution will be created. Observe folder structure and you can observe PkgFolder folder and ImportConfig.xml XML file also created as shown in the below figure,

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 7

After step 6, add your CRM customizations Solution exported Zip files and data files into PkgFolder only as an example I will be adding 1 CRM Customizations Solution zip type file with name ContactCustomizations_1_0_0_1 and a data zip type file with name accountdata_28062021 and save it as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 8

After Step 7, post addition of zip files to newly created CRM solution openImportConfig.xml file under PkgFolder Folder and specify data file name against crmmigdataimportfile as accountdata_28062021.zip marked with number 1 and CRM Solution zip file name under solutionpackagefilename as ContactCustomizations_1_0_0_1.zip marked with number 2 and which were added in the above step and comment out the other XML content present in the file and save it as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 9

After step 8, build a Solution as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 10

After step 9, all Nuget packages get re-aligned to CRM Related Dll’s, and then a DLL file with name CRMPackageDeploymentTemplateSample.dll gets generated and folder PkgFolder also gets generated under Debug/Release Folder -> Bin Folder, here as an example I considered Debug folder as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 11

After step 10, copy the above highlighted CRMPackageDeploymentTemplateSample.dll and folder PkgFolder and paste them in Tools\PackageDeployment folder which was generated by using power shell refer to my earlier article to know how to generate here as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 12

After step 11, open the required CRM solution and observe no new solutions are present in the selected CRM environment as well as no accounts are present in the account entity before execution of the Package Deployer tool as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 13

After step 12, navigate to the PackageDeployment folder under Tools and click on PackageDeployer.exe  a new window with title Package Deployer for Microsoft Dynamics CRM will open, and then click on continue in that window as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 14

After step 13, a new popup will gets displayed there select option Display List of available organizations and then click on login and provide required login credentials as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 15

After step 14, after successful validation of credentials new window gets displayed which infers the Package deployer tool is working correctly, and in the new window click on the Next button as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 16

After step 15, you will see the below screen and click on the Next button as shown in the figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 17

After step 16, if all the files are correctly mapped from ImportConfig.xml then we can observe all green tick marks and if you want to see the log file, it can be viewed by opening the hyperlink and click on the Next button as shown in the figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 18

After Step 17Executing install actions gets executed, and as we have considered CRM customizations Solution Zip file and Data File we could see success messages (green ticks) of both solution and data import and click on Next button as shown in the figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 19

After step 18, a new window gets opened with the Installation Complete message, and click on Finish Button as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Step 20

After step 19, to test whether the above-mentioned solution and data file were imported successfully or not, open CRM Environment and observe solutions and account records in the Account entity as shown in the below figure.

Deploy Packages using Package Deployer Tool in Dynamics 365 CRM

Note

  1. During installation of Microsoft Dynamics CRM SDK Templates for Visual Studio, make sure all the Visual Studio windows are closed.
  2. In ImportConfig.xml, make sure to give exact names which are added in Package Folder in Visual Studio solution as specified in Step 5.
  3. Make sure to comment outlines that are present in the ImportConfig.xml file which you are not going to do the deployment.
  4. In case of any errors, verify the log file as specified in Step 17.
  5. All references in the Visual Studio solution get automatically restored as specified in Step 9.

Conclusion

In this way, one can easily use the Package Deployer tool without writing a single line of code and in few minutes changes can be deployed to the required environment.