What are the challenges you face when working across database platforms? Take the survey
Options

How to build and verify a multi-db solution in CI

christianaccachristianacca Posts: 24 Bronze 1
edited November 23, 2017 10:39AM in ReadyRoll
I'm not sure the best way to build and verify a multi-db visual studio solution in a CI build.

I have followed the recommendation here Continuous integration

But I hit a problem when the second, dependent, database is verified via creating the shadow database.

The error that I receive:
"D:\Git\Series5\src\Ram.Series5.Db\Ram.Series5.Db.sqlproj" (default target) (10:2) ->
(SqlProjectBuild target) -> 
  D:\Git\Series5\src\Ram.Series5.Db\Programmable Objects\dbo\Views\BinaryFile.sql : error : An error occurred while attempting to verify project scripts:  [D:\Git\Series5\src\Ram.Series5.Db\Ram.Series5.Db.sqlproj]
D:\Git\Series5\src\Ram.Series5.Db\Programmable Objects\dbo\Views\BinaryFile.sql : error : Msg 5313, Level 16, State 1, Server WIN10CCROWHURST\LOCALDB#941CA91A, Procedure BinaryFile, Line 12 [D:\Git\Series5\src\Ram.Series5.Db\Ram.Series5.Db.sqlproj]
D:\Git\Series5\src\Ram.Series5.Db\Programmable Objects\dbo\Views\BinaryFile.sql : error : Synonym 'dbo.BinaryFileTable' refers to an invalid object. [D:\Git\Series5\src\Ram.Series5.Db\Ram.Series5.Db.sqlproj]

Here's the exact MSBuild command I'm using (powershell):
$msbuild = 'C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe'
& $msbuild D:\Git\Series5\src\Ram.Series5.sln /target:Rebuild /p:Configuration=Release /p:GenerateSqlPackage=True /p:ShadowServer="(localdb)\ReadyRollShadow" /p:TargetServer="(local)\SQL2008R2" /p:TargetUserName="SeriesTrusted" /p:TargetPassword="****" /p:TargetDatabase="Series5"

My guess is that the parameters I'm supplying to MSBuild is intended to work only for a single database VS solution.

So my question, how can I achieve the following:
  • Run MsBuild using Visual Studio .sln to build the solution including the sql packages for each db (I don't want to maintain multiple VS .sln files or an .proj file specific to a CI build)
  • trigger the verification of each database in the correct order

I guess knowing the MSBuild command that I can use to run the db verification on it's own would be the key to getting this all working.

Thanks
Christian
Sign In or Register to comment.