Create a Schema Compare (psuedo) Template in Database Projects

By November 14, 2016.NET, Visual Studio

I have been doing a lot of Schema Compare operations using Visual Studio Database Projects lately. One thing that has bugged me is that if I am using any settings that are not default, there is no obvious way to save those settings to apply to another new compare.

Sure, I can save the entire .scmp file into my project, but often this is a local compare that I don’t want to add to my project. I create the compare, run it against some local database and then basically throw it away. But if I want to, say, turn off the option to “Block on possible Data Loss”, I have to set that same option every single time. And there are a lot of options to set here! Just in General, 62 separate options that I really do not want to double-check every time. Ideally, there would be global options for this. In fact, if I could make this a wish-list item, I even know right where it should go:

2016-11-14-16_40_18-options

But alas, there is no such setting that I can find. That’s not to say it’s not buried somewhere, in which case I’d love for someone to enlighten me! In the meantime, I have had to settle for a workaround. But a workaround that is working pretty well, so I thought I would share.

The psuedo-template

The approach is simple: create a blank schema compare file that is saved outside of the project, and includes the desired default settings. Even without assigning a target or source, those settings are retained and can be used as a kind of template for new compares.

Using the Tools menu, open a new, completely blank, schema compare.

2016-11-14-16_48_20-c_microsoft-visual-studio-administ

Set the defaults as desired for your custom compare. In my case, I have a couple of these saved with the settings I prefer.

2016-11-14-16_52_58-schemacomparetemplates

Save the file wherever is convenient to you, and then close the file. Now, either use the Recent Files or Open File operation to start from here when you need a non-default compare operation, and you no longer have to reset that options list every time!

Did you learn something? Check out some other related blogs on blog.falafel.com!


Also published on Medium.

The following two tabs change content below.

Latest posts by Falafel Posts (see all)