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:
- Create a solution package
- 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.
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.
It would complete the installation and show below message.
Once the installation is completed, open the visual studio and go to File menu
Click on New and then Project
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.
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.
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
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.
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.
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.