Versioning your database packages (.dacpac) with the new Build Agent

If you’re interested in versioning your database packages with the new build agent here is an easy way to get started.  I started off with the following PowerShell example of a build script from the Visual Studio product groups’ build docs for versioning C# and VB projects and made a few tweaks to update the relevant XML elements of the .sqlproj files.


update .sqlproj file XML attributes: DacVersion, DacDescription



I’ve put the file and the changes into GitHub so you are welcome to use and if you have any improvements to the script just submit a pull request.


update .sqlproj files


Here is the PowerShell script I added as a build step to my Build Definition in VSTS



The build number format string I’m using is defined on the General tab

$(BuildDefinitionName) $(MajorVersion).$(MinorVersion).$(date:yy)$(DayOfYear)$(rev:.rr)


MajorVersion and MinorVersion are variables defined on the variables tab


Happy Versioning!




About Wes MacDonald

Wes MacDonald is a DevOps Consultant for LIKE 10 INC., a DevOps consulting firm providing premium support, guidance and services for Azure, Microsoft 365 and Azure DevOps.

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: