Search code examples
c#visual-studiosqlprojdbproj

Include SQL Server PostDeployment from DB Project reference


We are splitting up one of our SQL Server DB Projects into two separate projects.

Core.DB
   Tables
   PostDeployment
   PreDeployment

Core.Seed (Reference to Core.DB)
   PostDeployment
   PreDeployment

I have the general "table" publish working but now I'm trying to figure out how to get the PostDeployment & PreDeployment scripts in the core folder to run.

Just to clarify. When I publish from Core.Seed I want to have all the table publish (this is working) but I also need the Pre & Post Deployment scripts from both projects to run.

I can't figure out how to make this happen. Any suggestions? Is this possible?


Solution

  • Doh (simple issue).

    So this solution will work for you if you have your referenced project in the same solution.

    In my PostDeployment.sql I have:

    :r .\..\..\Core.DB\PostDeployment\_BasePostDeployment.sql
    :r .\Client\_ClientPostDeployment.sql
    

    Which allows me to reference the other project.