Deployment Manager - 1.0
Creating database packages with MSBuild - Deployment Manager
If you are not using TeamCity, you can create database packages using a Red Gate MSBuild script. To use the script, you must have:
Example: packaging WidgetDev
In the following example, we will run the Red Gate MSBuild script to package our WidgetDev database for deployment.
For more information on using MSBuild, see: MSBuild reference (Microsoft documentation).
The example has three steps:
- Downloading and unzipping sqlCI.zip
- Editing the sqlCI.targets file
- Running MSBuild
1. Downloading and unzipping sqlCI.zip
- Download the build script from the Red Gate website:

- Unzip sqlCI.zip to a location on your computer.
In this example, we are using D:\Database Packages.
sqlCI.zip contains the files required to create database packages. To specify the database you want to package, and where you want the package to be created, you need to edit the sqlCI.targets XML file.
2. Editing the sqlCI.targets file
When you edit sqlCI.targets, you must specify a value for at least the following XML elements:
- <scriptsfolder>
The location of your database (scripts) folder.
In this example, we have checked out our database from source control to a local working folder:
<scriptsfolder>D:\Databases\WidgetDev</scriptsfolder>For information on scripts folders and source control, see:
- Working with scripts folders (SQL Compare documentation)
- Worked example: setting up SQL Source Control (SQL Source Control documentation)
- <generateCreationScript>
Specify
<generateCreationScript>true</generateCreationScript>to generate a SQL script to create the database. The creation script is included in the package. - <packageVersion>
The version number for the database package.
In this example, our database is at version 1.0, so we specify
<packageVersion>1.0</packageVersion>Note that if we specify a version number, we need to update sqlCI.targets when we want to create a package with a different version number.
If you want to run the build script from a continuous integration server, you can specify a variable. For example,
$(build_number)for TeamCity, or$(CCNetLabel)for CruiseControl.NET. - <packageId>
The name (or ID) for the database package.
In this example, we specify
<packageId>WidgetDevDatabase</packageId>
If you specify a value for only these four elements, when you run MSBuild the package will be created in the folder where you unzipped sqlCI.zip.
In our example, we want to publish the package to a feed. To do this, we also specify values for:
- <packageRepository>
The URL of your NuGet package feed.
In this example, we specify
<packageRepository>http://localhost:62759/nuget</packageRepository>For information on creating package feeds, see: Hosting your own NuGet feeds (NuGet documentation).
- <apiKeyForPackagePublish>
The API key for your package feed.
In this example, we specify
<apiKeyForPackagePublish>apikey</apiKeyForPackagePublish>
3. Running MSBuild
Now we have specified the required values in sqlCI.targets, we can run MSBuild to package our database.
You can run MSBuild from a continuous integration server (for example Team Foundation Server, CruiseControl.NET, or Jenkins), or from the command line.
To run MSBuild from the command line:
- In Windows Start menu, click All Programs.
- In the Microsoft Visual Studio folder, under Visual Studio Tools, click to run the Visual Studio Command Prompt.
- From the command prompt window, navigate to the folder where you unzipped sqlCI.zip.
In our example, this is D:\Database Packages.
- Run
msbuild.MSBuild runs, creates the package, and publishes it to the package feed.
Deploying the package
To deploy the package we have created, we need to specify some variables in Deployment Manager.
Was this article helpful?
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Installing and upgrading