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.
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!
Sadly the test won’t currently run on the hosted build agent because sqllocaldb is not installed correctly on build agents (BOO!)
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.