Gerard

Setting up Red Gate SQL Source Control for TFS on visualstudio.com

by Gerard on 28. December 2012 13:03

Microsoft's new cloud version of Team Foundation Service was released a couple of months ago on tfs.visualstudio.com, and given that we use Red Gate's excellent SQL Source controlproduct to manage database changes here at Red Jungle I expect more and more people will be like us and want to link their databases to their TFS server they have set up on tfs.visualstudio.com. I have just done this, and, (mostly because of the inaccurate instructions that Red Gate has published at the moment), you currently have to jump through a few hoops to get this all working nicely. I thought I would share my experience, hopefully saving some people a bit of time. (Note: I am assuming below you use Visual Studio 2012).

First of all, make sure you have at least version 3.1 of SQL Source Control installed. If not update.

Then, when you try to link a database to SQL Source Control, there is a little notice sitting under the server URL box:

sql_source_learn_more

This link, however, takes you to a page which has totally incorrect instructions. So please ignore this one. Google a bit and you probably get to

http://sqlblog.com/blogs/andy_leonard/archive/2012/10/08/redgate-sql-source-control-and-tfspreview.aspx, which is a better, but still has a vital error in it with regards to the configuration file content.

The following steps got me to over the line:

  1. Close SQL Server Management Studio
  2. Install Microsoft Team Explorer Client, you can download it from here: http://www.microsoft.com/en-us/download/details.aspx?id=30656
  3. Manually edit the SQL Source Control configuration file
  4. Start SQL Server Management Studio again
  5. Select the URL for your server
  6. Browse for the folders where you want your database version information stored.

In these steps 3 and 5 are the ones that are essential and incorrect or missing on the links above. I will go into these a bit more.

 

Edit SQL Source Control Configuration file

The SQL Source Control file is located in the “Local” folder for your AppData. For me that is in:

C:\Users\Gerard\AppData\Local\Red Gate\SQL Source Control 3

Note that you may not see this folder, if you are not showing “hidden” folders in Windows Explorer. The file you need to edit is RedGate_SQLSourceControl_Engine_EngineOptions.xml.

Open this file in a normal text editor and edit it. Unless you have changed this already, you will see a self closing EngineOptions tag:

<EngineOptions version="3" type="EngineOptions" />

Because you need to end content in here, you will need to change this into a tag and a closing tag:

<EngineOptions version="3" type="EngineOptions">
</EngineOptions>

Then insert the following tag inside the EngineOptions tag:

<TeamFoundationServerDllOverride>
RedGate.SQLSourceControl.Engine.SrcC.TFS2012
</TeamFoundationServerDllOverride>

So far this is as in Andy’s blog, but this is not really correct yet. The next step is vital to make this work: Remove all the white space from this latest insert, including the line breaks! If you do not do this, you will just get an error message that you need to install Microsoft Team Explorer Client to be able to use SQL Source Control.

The content of your configuration file should then look like this:

sql_source_config_file

Okay. So far so good. Start SSMS again and select the database to link. All you need to do now is connecting to your TFS server

 

Connecting to your TFS Server

To do this you need to specify the Server URL. For me the natural choice for this was to specify the visualstudio.com URL:

sql_source_server_incorrect

This however generates an error:

sql_source_url_error

The solution is to add your TFS collection folder to the Server URL; we are just using the DefaultCollection at the moment:

sql_source_server_correct

And with that, I could browse to a folder for my Database and Migrations Scripts folder. Which made me a happy developer.

Tags:


Comments (1) -

Phil
Phil New Zealand
12/30/2012 10:13:13 PM #

Another gotcha to be wary of is that at the time of writing the version that Red-Gate have as their download link for SQL Source Control is not the latest version - so even if you've only just downloaded and installed it, try using the built in update to check for the latest before you try and set this up.