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.

snag-3763

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.

snag-3761

update .sqlproj files

 

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

snag-3764

ApplyVersioningToAssemblies.ps1

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

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

snag-3765

MajorVersion and MinorVersion are variables defined on the variables tab

snag-3766

Happy Versioning!

 

 

 

About wesmacdonald

Wes MacDonald is a Visual Studio ALM MVP, PSD, MCT and a Principal Consultant for LIKE 10 INC., a SharePoint Server, Visual Studio and Team Foundation Server Consulting Firm providing premium support and guidance services.

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: