18 Nov 2016 | Dynamics CRM | Dynamics CRM Online | generator-nullfactory-xrm | Visual Studio Team Services | Team Foundation Server | ALM
This is the final installment of the a three part series. Use to following links to access part 1 and 2:
In the previous two posts I show you how to create the project structure and create a basic team build for your CRM solution artifacts. In this final installment I go about setting up a release definition for the build that we created.
Build and Release > Release
in your team project.Select the Empty
template option and click the next button.
On the next step, choose the source for this release - we'll be using the build definition that we created in part 2. Once ready click the Create
button.
Now lets declare the variables that would be used later in the process. Navigate to the Variables
tab and define the following variables:
DevDeployLogin
- The username that used to deploy the solution.DevDeployPassword
- The password for the same account.Make sure to define the DevDeployPassword
as a secret by clicking the padlock icon next to the field.
Read more about build and release variables here.
Next, create a new agent step by clicking the Add tasks
and selecting Add an agent phase
in the context menu.
Select a PowerShell
in the task catalog and click the Add
button.
Once the task is added, set the type to Inline Script
and add the following script in the Inline Script
field:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser
The purpose of this script is to install the NuGet provider on the agent. This is a prerequisite of the Install-Module
command that will be used by the Deploy-CrmSolution
script.
And while we're here, let's rename the task to a more appropriate one. This would help us to distinguish it better.
Now, add a second PoweShell script. This time set the type as File Path
and rename the task to Deploy CRM Solution
. This task would be performing the actual deployment to CRM.
Click the ellipsis on the Script Path
field to browse and find the Deploy-CrmSolution.ps1
script.
$(System.DefaultWorkingDirectory)/DevBuild/drop/Nullfactory.Xrm.Tooling/Scripts/Deploy-CrmSolution.ps1
Set the following arguments for the script - notice that the previously defined variables DevDeployLogin
and DevDeployPassword
being used as part of the script.
-serverUrl "https://servername.crm6.dynamics.com" -username "$(DevDeployLogin)" -password "$(DevDeployPassword)" -solutionName "Demo.AlphaSolution" -publishChanges -activatePlugins
Expand the Advanced
tab and click the ellipsis button on the Working Folder
field. Set the working folder to the Nullfactory.Xrm.Tooling\Scripts
folder on the resulting dialog. I do this in order to minimize the chance of encountering any long file path issues.
Now that everything is setup, time to test out our new release definition. Let's queue a new release.
Ensure that the release is being deployed and that it completed successfully.
That's it folks. That's the end of the three part series showing how to setup a project structure, configure a build and finally release a source-controlled CRM solution.