Create VSTS/TFS build
Published 25 July 2017
This page walks you through the process of building a ReadyRoll project with Microsoft's VSTS and TFS.
Installing the ReadyRoll VSTS/TFS extension
The easiest way to do continuous integration with ReadyRoll using VSTS/TFS is to use the ReadyRoll extension.
Follow the instructions on how to install the ReadyRoll VSTS/TFS extension here.
Setting up a ReadyRoll build definition in VSTS/TFS
Ensure that you have a ReadyRoll project checked into source control on VSTS/TFS. For more information about setting up a ReadyRoll project see Getting started.
There are two ways to set up a ReadyRoll build definition depending on the version of TFS you are using, or if you are using VSTS.
VSTS and TFS 2018 RC1 (and later) users
The easiest way to set up a ReadyRoll build definition is to use the ReadyRoll build definition template.
- In VSTS/TFS, create a new build definition
- Select the ReadyRoll template
- Click Apply
TFS 2015 and TFS 2017 users
These versions of TFS do not support build definition templates, so it's not possible to use the build definition template provided by the ReadyRoll extension.
This means you must set up the ReadyRoll build definition manually.
Configuring the build
Check build tasks
If successful, you should have the following build tasks, in order, in your build definition:
- NuGet Tool Installer*
- ReadyRoll Download Build Components*
- ReadyRoll Set Target Database
- Visual Studio Build
- Copy Files
- Publish Build Artifacts
The tasks described here may differ from the tasks you see in your version of TFS.
If so, it may be necessary to manually update or install the tasks from the Visual Studio marketplace.
Instructions on how to do this can be found here.
*NuGet Tool Installer and ReadyRoll Download Build Components
These two tasks are designed to ensure the agent machine has the latest version of the ReadyRoll Build Components installed. These are optional tasks.
If these tasks cannot be included (for instance, the version of TFS you are using doesn't support one/both of them) you must ensure the agent machine has the ReadyRoll Build Components installed. You can find information about how to do this here.
Choose a build agent
In the Agent queue drop-down, choose a build agent
The ReadyRoll build definition template will automatically download the ReadyRoll build components to your build agent through the NuGet Tool installer and ReadyRoll Download Build Components tasks.
If that doesn't work for any reason, or if you would like to control the versioning of build components, you can also install the ReadyRoll build components onto your build agent or solution.
Configure the Target database
The target database is only used for generating the build artifacts and it will not be modified.
It is a database in one of your environments, for example test, staging, or production.
It is required for generating a preview report, generating a diff report, generating a drift report & drift correction script, and generating a patch deployment script.
Click the Set Target Database build task
- Fill in the fields for the target database you have chosen
Configure the Shadow database
In order to validate the migration scripts and to generate reports & a drift correction script, a shadow database is required during a build.
The shadow database is a temporary database where ReadyRoll can run your migration scripts. By running the migration scripts on a real database, SQL Server will check that they are valid SQL with no syntax errors, missing dependencies, etc.
It's often easiest to use LocalDB for the shadow database, and so the ReadyRoll build definition template is pre-configured to use LocalDB (if needed, you can choose other options under Advanced).
- Click the Triggers tab
- Choose the triggers, for example, most people enable the Continuous Integration trigger
- Click Save & queue
- In the dialog, click Queue