Dynamics CRM Package Deployer

1 Comment

Packages can be deployed from one environment to another using the Dynamics CRM package deployer. Let’s go through an example of how to use the tool.

We will create a sample solution called the “Sample Application”. The application has a custom entity called “App Configuration”. This contains records that hold data for the configuration. This entity and data exists in our development environment.

Now, we will create a package that exports this into our production environment.

Export the solution to a directory:

Create a new Visual Studio project and select CRM Package from CRM SDK Templates:

Solution opens:

You may have missing references:

Readd the references. You may find some such as the Microsoft.Xrm.Tooling.PackageDeployment.CrmPackageExtentionBase.dll in the extract PackageDeployer folder.

Add the solution created above to the PkgFolder folder in the solution:

Set the output to Copy Always:

Create a schema XML file and a data export file using the Configuration Migration tool, for the new solution and the 2 records we created. Copy the 2 files created to the same PkgFolder folder and set the same output property:

Open the ImportConfig.xml file. Include the data.zip file and the solution package file as below:

Build the solution.

We can now deploy the solution to our new environment.

Copy the PkgFolder and the output CRMPackageDeploymentSampleApp.dll bin to the SDK Tools\PackageDeployer folder. The folder should look like this:

Run the PackageDeployer.exe:

Ensure the DLL is in the root PkgFolder folder or you will get this error “No import packages were found. Exiting the program”:

Package deployer should show:

Enter the details of your destination system:

You will see this screen below.

Note you can customize this screen in the solution – it is an HTML page where you can add additional information in the solution:


Click Finish:

Now log into the destination system and go to solutions. You will see the new solution loaded:

Data has come across into the new system:

To deploy by PowerShell, do the following:

Open Powershell running as Administrator. Then CD to the SDK PackageDeployer\PowerShell directory. Run the command:


And then the command:

Add-PSSnapin Microsoft.Xrm.Tooling.Connector


Add-PSSnapin Microsoft.Xrm.Tooling.PackageDeployment

Our package is still in the same location as below. If we run the command below it will show us what packages are in any directory:

Get-CrmPackages –PackageDirectory <directoryname>

Type the command:

$Cred = Get-Credential

This will display a login prompt. Log in to the destination organization have the details stored in the $Cred variable.

Now, type the command to connect to CRM. We will connect to a 365 instance:

$CRMConn = Get-CrmConnection -DeploymentRegion NorthAmerica –OnlineType Office365 –OrganizationName <your_Org_Name> -Credential $Cred

Now type the command to import the package:

Import-CrmPackage –CrmConnection $CRMConn –PackageDirectory c:\CRM\SDK\Tools\PackageDeployer –PackageName SampleCRMPackage.dll –UnpackFilesDirectory c:\UnpackedFiles -Verbose

The import will give some details and then complete.

Now we have the package set up we can easily run updates to deploy to different environments. For example, let’s add a new record and field to our entity in the development environment. We will also update an existing record:

Run the Configuration Migration tool and export the new schema and data:

Overwrite the files in the PkgFolder:

Rerun the package deployer. You can rerun the same powershell script as nothing has changed.

Now go into the destination environment. What happens is the customizations have not changed. The reason is, the package deployer did not overwrite the existing customizations:

If we want the packager deployer to overwrite, we need to add to our ImportConfig.xml file:


There have been reported issues using this flag. The workaround is to increment the version number of the solution. This will always import the latest version regardless of the flag.

Rerun the import. Once complete, the updated solution and data are in the destination system:

The package deployer provides a way of helping to standardize deployments and decrease time to deploy.


Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube


One Response to Dynamics CRM Package Deployer

Leave a Reply

Your email address will not be published. Required fields are marked *