Search code examples
visual-studiodatabase-project

Deploy more database project in one step


I have two database projects in Visual Studio 2015 in one solution. The first one is a database assembly and the second one is a pure database project (schemas, tables, indexes, stored procedures and functions) and some post-deployment scripts, which use some functionality from database assembly.

Sometimes I need to deploy the database project to a new database (new instance of application), but deploy failed, because it is not deployed database assembly.

My questions is: Is there any way to deploy two projects in one step or any idea how to make this in one step (deployment is handled by customer and their administrator often forgets deploy db assembly and I would like to make deployment more much easier for him )?

Thanks


Solution

  • You could create a .bat file to publish both projects. E.g.:

    SqlPackage.exe /Action:Publish /SourceFile:./Project1/Project1.dacpac /Profile:./Project1.Release.publish.xml
    SqlPackage.exe /Action:Publish /SourceFile:./Project2/Project2.dacpac /Profile:./Project2.Release.publish.xml