VSTS:DB Composite Projects

February 4, 2009 at 11:16 am (SQLServerPedia Syndication, Tools, Visual Studio) (, , , )


I’ve seen several searches go by from people who are looking for how to create composite projects. Here’s a quick run-down. In the example, I’m going to create a main database project called BaseDB, a server project called MyServer, and a composite project that combines the two called Comp. This project is just another database project as you can see in Figure 1:

New Database Project

New Database Project

Once the new project is created, you need to right click on the References object in the Solution Explorer. Figure 2:

fig2

From the pop-up menu select Add Database Reference. The window in Figure 3 will pop up:

Add Database Reference

Add Database Reference

You can select the other projects for a dynamic view into their changes, or for a static look you can select a .dbschema file. Unfortunately, the .dbschema file is very static. You won’t get changes as they’re made. Usually I use the projects.

You can try to affect Database Reference Variables for the project, but usually this isn’t necessary. If there are indirect references you can suppress them. Again, this isn’t something I’ve had to use so far.

Once you’ve created the references to other projects or .dbschema files, you can see these on the References tab of the project Properties as shown in Figure 4:

fig4

You now have a composite project. There are a number of other options you should consider. For example, how are the deployments done. One common approach that I’ve taken is to have the base database do a full rebuild of the database and then have the other two projects do incremental deployments. You’ll need to make sure that all the same Configurations are set up between the projects so that the stuff like the connection strings are the same between projects. You’ll want to make sure that the base project and the composite project are deploying to the same database name.

There’s more, but that should get you started.

1 Comment

  1. VSTS:DB More on Composite Projects « Home of the Scary DBA said,

    […] projects are created directly through the VS GUI as new projects and I covered that a bit in the last post. Partial projects are something […]

Leave a comment