Over the recent past I’ve been working on a variety of build/deploy PowerShell scripts that make use of Microsoft.Data.Tools.MSBuild. And I’ve been wanting to get like a standardized “this is how I would do it” set of scripts together. And so I’m happy to say  that I’ve got around to it. The source code is on GitHub, and the releases are on both NuGet and PowerShell Gallery.

There is a test file to to show the expected workflow. There is also a readme, which whilst not at the root, is included in both release channels.

Becausethe test requires a whole sqlproj to build and deploy from, this is only available via the GitHub repo.

There is indeed published via a build that even has its own build badge!

And it genuinely does stuff to!

There’s still a few things I’d like to do to it, but as long as you’re running a Windows machine with .NET 4.6.1 installed, there are no other pre-requisites as it downloads/installs MSBuild 2017 if it isn’t already installed, and downloads NuGet so that we can get Microsoft.Data.Tools.MSBuild. A lack of dependencies is always a good thing!

What I might do is add the localDB download/install script as some functions, so that the test script can make use of those. Or rather, I’d imagine that some build agents would benefit from having a lightweight install of SQL Server, so that the DACPAC can be deployed and tests run.