Understanding D365 CE solution Deployment – Package Deployer

In the previous post, we saw how to create a package containing multiple solutions and configuration data. Let us see how to deploy this package using package deployer tool.

What is package deployer? As CRM technical, we all have used plugin registration tool. Similarly Microsoft provides a tool for package deployment, is called Package Deployer. Before we deploy the package using the package deployer, make sure that it is done in test environment and after verification only should be used for production site.

As we created the package in previous post our package is ready in the Project’s bin folder, inside the debug folder as shown in below snippets.

Project’s folder

Project Folder

Inside Project’s folder, there would be bin folderProject Folderbin

Inside bin folder, there would be debug folder

Project Folderdebug

Inside the debug folder, we can see the PkgFolder and the dll of our package. These two are important items used for deployment. The PkgFolder would consist of the content folder, solutions and data file and import.config file. If you remember, in previous posts, we have selected the Copy always option for these files, hence this folder is copied in the bin folder, when we build the project.

Project Folderdllandfolder

Let us copy these two items ( PkgFolder and project dll file) to some folder, let us say LearningPkgDeployment is the folder name

To obtain the package deployer tool, we have to visit the below site and download the nuget.exe

https://www.nuget.org/downloads

both files

Click on the Download Package Link as shown in below snippet.downlad deployer

Once downloaded the package deployer installable, if it is saved in the folder D, then go to the d folder in command prompt and install this using below command

d:\nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf -Version [VERSION] -O d:\PD

This will install the package deployer tool to our machine. Once installed , we can use it the same way we use the plugin registration tool. Let us go to the folder which will look like below snippet and copy the above created package dll and Pkgfolder to this folder.

deployer

After copying the two items, double click the package deployer application. It will as for credentials to connect to CRM organisation as we do for plugin registration tool. Just follow the subsequent instructions as the application progresses and we can get our package deployed to target organisation.

As we run the application and deploy the package, we can also do the same using command line. Difference is only after the coping the dll file and pkgfolder to the package deployer root folder, we can go to the command line and run below command

packagedeployer.exe

Hope with all these series of posts regarding deployment, you are able to understand the deployment process in dynamics 365 CE. I know one important topic is still to be explained which is deployment using Power shell scripts, which I will explain in later posts.

Keep reading and keep deploying ūüôā

Thank you so much for reading my posts.

Continue reading “Understanding D365 CE solution Deployment – Package Deployer”

Understanding D365 CE solution Deployment – Packaging – Part 1

In previous post we have seen manual import and export method for the solution deployment. In this post let us see the deployment using package deployer.  Now we know manually export and import of the solutions is quite simple and easy to do, then why do we need a package  deployer for solution deployment?

  • In Manual export and import, only one solution can be deployed¬† at a time , and only solution can be deployed, however the package deployer would enable us to deploy the data in terms of flat files, xml files , multiple solution files
  • Even we can write some code which can be executed while we do the deployment.

To deploy the solution using package deployer, we have to create a package consisting of all our files such as solution files, data files etc and then we can deploy that package.  While we deploy the package using package deployer, it gives us a feel of set up file being deployed with customized welcome page to start with and an customized ending page, once the installation/ deployment is over.

Let us divide this deployment in two steps:

  1. Create a solution package
  2. Using Package deployer to deploy the solution

To create the solution package, we need below :

  • we should have our solution(s) and the data files ( how to create the data files will see in later posts) ready
  • Visual Studio 2015
  • CRM SDK package installed on VS 2015

To install the package template, go to the site install template and download.

Download Package template

It will download the CRMSDKTempaltes.vsix file as shown in below snippet, just double click on the vsix file and installation would start.

We need to check which version of visual studio and click on install as shown in below snippet.

Install Template1

It would complete the installation and show below message.

Install Template2

Once the installation is completed, open the visual studio and go to File menuNew project

Click on New and then Project

New project2

As we have installed the CRM SDK package, we can see¬† CRM¬† SDK Template under installed. In case we won’t see this option under Installed, understand that the CRM SDK package is not installed or visual studio is not restarted post installation.

Select the CRM package.

New project3

Enter name of the project and select the location for the new project and click on OK.

The project will be created and if we see in the solution explorer,  there will different type of files and folders by default created as shown in below snippet.

Project Files

I have given project name as PackageDeployerpost, hence the solution and project are created with the same name. This template consists of default folders such as GettingStarted and PkgFolder and files packages.config and PackageTemplate.cs

Project Files1

Gettingstarted folder is just for reference , it is not required in the project. However PkgFolder is most important folder in the package. It consists of Content Folder and ImportConfig file. Let us discuss the details about all these files in my next post.

Project Files2

One important thing we need to remember that for any file which is added in the pkgfolder, we need to check the property CopyToOutputDirectory set to Copyalways as we want these files to copied to the final package.

The steps to do the same are as shown in below snippets.

Select the file, right click and click on Properties.

PackageFolder
PackageFolder1

Select the Copy to Out Directory Property and set as Copy Always. For default files, it will be always set , however need to set for any new file which will be added later. Continue reading “Understanding D365 CE solution Deployment – Packaging – Part 1”