Manual export and import of solution from development to test, to UAT, to production environment usually takes a lot of time. In this blog post, we will discuss the detailed step-by-step on how we can use Continuous Integration (CI) and Continuous Delivery (CD) of Visual Studio Team Services (VSTS) to automatically export and import solution from development environment to higher environment.

Before we start, we will be needing two Microsoft Dynamics 365 environment: 1) the source where the solution will be from, and 2) the target where we need to import the solution. We also need to install “Dynamics 365 Build Tools” template that was created by Wael Hamze to our Visual Studio Team Services. This template contains the “tasks” we will be needing for this blog post.

Create VSTS Project & Solution

  1. We will start by creating a VSTS project. (You can use an existing project if you already have one.)

  1. Open your Visual Studio App, connect to your newly created project and create a clone of your project in your local machine.

  1. Add any solution to the project (auto build will run and will throw an error if there is no project solution) and push to VSO.

  1. Create a new folder under your project solution. This is where we will store the exported Dynamics 365 solution.

Continuous Integration: Build Definition

  1. Create a Build Definition, start with an Empty Process.

  1. Select “Hosted” for the “Agent Queue”.

  1. Now, we have to add a task that will publish customizations in Dynamics 365. This is will ensure that the components on the solution we’re going to export are all published.

  1. Specify the connection string of the source environment. We can use either “variable” or directly input the connection string.

Using variable

Not using variable

  1. Next is the task that will export the solution from the source environment. Specify the connection string and name of the solution and location where the solution will be stored.

  1. Last is to add the task that will publish the downloaded solution in VSO.

  1. Click “Save and Queue” button and wait until the build is complete.
  2. If the build is successful, you should be able to see the “Artifact” on the completed build.

Continuous Delivery: Release Definition

  1. Create a Release Definition and start with an Empty process.

  1. Click on the “Add Artifact” button and select the build definition we previously created so that we can access its artifact.

  1. Add the task that will import the Dynamics 365 solution to the target environment and click save button.

  1. Test the release definition.

  1. Click on Start, select the latest build then click start button.

  1. Verify that deployment status is “Succeeded”.

  1. If you would like to run this after Build is completed or scheduled, you can configure it on the “Triggers” tab.

 

That’s it! Hopefully this blog was able to help you configure Continuous Integration and Continuous Delivery in Dynamics 365 using Visual Studio Team Services. If you have questions or concerns, let me know in the comments box below.