5

I have a VS2012 database project which includes tables, stored procs, views etc.

I then have a second database project which contains a database reference to the first project. I have ensured that the "Include composite objects" options is selected from the "Project Properties -> Debug -> Advanced" menu.

When I build the second project and take the resulting DACPAC file and deploy it through SSMS2012 it doesn't create the firsts project's objects.

Am I missing something? Why don't the composite objects get included in the DACPAC?

SmudgerDan
  • 413
  • 5
  • 16
  • I probably don't understand everything here, but thought that it generated multiple dacpac files (or copied other ones) when SSDT is told to include composite objects. I haven't tested that enough to verify, though. What happens if you deploy through SQLPackage instead of SSMS? – Peter Schott Sep 03 '13 at 17:22
  • I see it has generated dacpac files for the first & second projects. I was intending to deploy using a Powershell script & the Microsoft.SqlServer.Dac.DacServices class. So I should deploy the referenced (first) project's dacpac then the second project's dacpac? – SmudgerDan Sep 03 '13 at 19:52
  • That's what I do, but I have not really tried to do any other method. Building and publishing the projects "in order" has always ensured that each project releases separately and as expected. – Peter Schott Sep 04 '13 at 19:31

2 Answers2

3

As Peter Schott said in the comments above, I needed to deploy both outputted Dacpacs in order, with the referenced database first.

You cannot do this through SSMS, it won't allow you to deploy two different Dacpacs to the same database. But it is not a problem through SQLPackage.

Community
  • 1
  • 1
SmudgerDan
  • 413
  • 5
  • 16
2

I had the same problem when publishing dacpac with dacfx. As answered here, I had to activate the "Include composite objects" option. But that's not all. When you compile your project, Visual Studio generates two dacpac files in your "second" project. You must put both files in the same directory when you deploy the second project.

Hope that helps, for me it did ;-)

Community
  • 1
  • 1
Weissvonnix
  • 731
  • 7
  • 23