Dynamics 365 can be difficult to manage in multiple developer environments. There is always a requirement to track code changes and other changes happening in the CRM. Though Dynamics 365 offers Auditing features and capabilities for the Data stored in CRM, it doesn’t provide any feature to manage source code or CRM customization. In order to manage source code we will be using the below.

Pre-Requisites

  1. PowerShell v3.0+ should be installed.
  2. Necessary Code Structure and project should be present in Visual Studio (VS2015)

Source Control Automation

Open PowerShell ISE with administrator privileges. Type the below command to change the execution policy.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

To Export and Extract Solution to Visual Studio for Check-In

  • Change all configurations in Settings.xml file to perform the Export.
  • Run the Script to Export the Solution from CRM and Extract to Visual Studio Solution Folder : AddPathToFile\ExportExtractSolution.ps1
  • You will see the solution files in the folder you specified in the settings. Check – in the Extracted Files in Visual Studio

To Pack & Import Solution to CRM Environment.

  • Change all configurations in Settings.xml file to perform the Import.
  • Check – out the Solution Files in Visual studio.
  • Run the Script to Pack the Solution using files from Visual Studio Solution Folder and Import to CRM : AddPathToFolder\PackImportSolution.ps1
  • The script will Import & Publish the solution to the targeted CRM environment.

Plugin Registration Automation

  • Open the Config.xml file and add the Plugin or Workflow Activity configurations.
  • Open PowerShell with Administrator privileges. Type the below command to change the execution policy.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  • After running the above script run the PowerShell script by typing the below command: PathToFolder\DeployAssemblies.ps1
  • For Eg: D:\DynamicsCRMAutomation\DeployAssemblies.ps1

For the Source Code check out my gitHub repository.