Release Strategy for Dynamics CRM - Part 5 - Deploy Third-Party Solutions

More often than not the custom Dynamics 365 solutions I develop depend on third party solutions to provide additional functionality. Therefore these solutions become a pre-requisite to the successful deployment of my own solution.

In this post I go about updating the previously setup project, build and release definitions in Visual Studio Team Services (VSTS) in order to enable deployment of third party CRM solutions.

Pre-requisites

  • Project structure and deployment scripts based on generator-nullfactory-xrm (with a minimum version of at least 1.4.0).
  • A working build and release definitions already setup.

Read more about setting up the project structure and build here:

Project Structure

I start off by adding a solution level folder to hold third party solutions and check-in the changes into source control.

Project structure

Build

Next, we update the build to ensure that the solutions are included as part of the build drop. I add a Copy Files task with the following parameters:

  • Source Folder: $(build.sourcesdirectory)
  • Contents: **/_prereq-solutions/*.zip
  • Target Folder: $(build.artifactstagingdirectory)

Updated build definition

I trigger a new build to make sure that the solutions are copied over as part of the build artifacts.

Release

Now that our third-party solutions are included as part of the build drop, its time to deploy them. In this scenario I deploy all the solutions contained within the _prereq-solutions folder.

I added a new PowerShell task as a precursor to the main solution deployment. I set it as an inline script with the following body:

Get-ChildItem "..\..\_prereq-solutions\" -Filter *.zip | 
Foreach-Object {
    .\Deploy-CrmSolution.ps1 -serverUrl "$(sndbxservername)" -username "$(sndbxusername)" -password "$(sndbxpassword)" -externalSolutionFileName $_.FullName -publishChanges -activatePlugins -importAsHoldingSolution:$false
}

I also set the working folder to the Nullfactory.Xrm.Tooling/Scripts folder.

This script iterates through all the solutions in the folder and attempts to deploy them.

Updated release definition

If you have multiple inter-dependent third-party solutions and require them to deployed in particular sequence you can either:

  • Add additional PowerShell tasks for each of the solutions.
  • Rename the solutions with a ranking number so that the GetChild function orders and execute them implicitly.
comments powered by Disqus