Thursday, August 31, 2017

Enable TFS and Git Source Control Integration in SSMS 2016

 
   
      Source Control is must have for programming, It is pretty important for SQL Server too. I think It became more important with addition of R and Python language supports. I believe some third party applications have this option. Of course you need to pay for it too. Your company might have TFS already or may be you use Git for Source Control which are already in Visual Studio by default. When you open the SSMS 2016, what is the first thing do you see?


   SSMS 2016 (version 13) uses Visual Studio 2015 Isolated Shell. That is a big change for source control options because the integration with source control systems in older version no longer works the way they did in SSMS 2016. You could install the Visual Studio MSSCCI provider and then integrate with various source control systems. Visual Studio 2015 does not support this method anymore.

  Visual Studio 2015 includes TFS and Git source control integration by default. Since SSMS 2016 built on VS 2015, we should be able to use these options. Here is the step by step how to enable TFS and Git Source Control Integrations in SSMS


  • First you want to be sure that Visual Studio 2015 is installed to your machine! Microsoft says Community Edition will work fine too. If you have it, you can move to the next step.
  • Close the SSMS if it is open.
  • You need to be Admin in your machine for this step. Open the notepad in Admin mode. This step is important because you need to be an admin to save the changes you are going to make.

  • Change the file type to All Files first and open the file named ssms.PKGUNDEF in the following folder:
    •  C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio

     You are going to focus on the following part of the file.This part disables the TFS and Git Source control integrations.

// ********
// Remove unused packages
// ********

// TFS SCC Configuration entries.  The TFS entries block Team Explorer from loading.
// Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage
[$RootKey$\AutoLoadPackages\{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}]
// Microsoft.VisualStudio.TeamFoundation.Lab
[$RootKey$\Packages\{17c5d08a-602c-4dfb-82b5-8e0f7f50c9d7}] 
// GitHub Package
[$RootKey$\Packages\{c3d3dc68-c977-411f-b3e8-03b0dccf7dfc}] 
// Team Foundation Server Provider Package
[$RootKey$\Packages\{5BF14E63-E267-4787-B20B-B814FD043B38}]
// Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.WitPcwPackage
[$RootKey$\Packages\{6238f138-0c0c-49ec-b24b-215ee59d84f0}]
// Microsoft.VisualStudio.TeamFoundation.Build.BuildPackage
[$RootKey$\Packages\{739f34b3-9ba6-4356-9178-ac3ea81bdf47}]
// Microsoft.VisualStudio.TeamFoundation.WorkItemTracking
[$RootKey$\Packages\{ca39e596-31ed-4b34-aa36-5f0240457a7e}]
// Microsoft.VisualStudio.TeamFoundation
[$RootKey$\Packages\{b80b010d-188c-4b19-b483-6c20d52071ae}]
// Microsoft.TeamFoundation.Git.Provider.SccProviderPackage
[$RootKey$\Packages\{7fe30a77-37f9-4cf2-83dd-96b207028e1b}]
// Microsoft.VisualStudio.TeamFoundation.VersionControl.SccPcwPluginPackage
[$RootKey$\Packages\{1b4f495a-280a-3ba4-8db0-9c9b735e98ce}] 
// Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage
[$RootKey$\Packages\{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}]
// Visual SourceSafe Provider Package
[$RootKey$\Packages\{AA8EB8CD-7A51-11D0-92C3-00A0C9138C45}]
// Visual SourceSafe Provider Stub Package
[$RootKey$\Packages\{53544C4D-B03D-4209-A7D0-D9DD13A4019B}]
// Microsoft.VisualStudio.TeamFoundation.Initialization.InitializationPackage
[$RootKey$\Packages\{75DF55D4-EC28-47FC-88AC-BE56203C9012}]
// Team Foundation Server Provider Stub Package
[$RootKey$\Packages\{D79B7E0A-F994-4D4D-8FAE-CAE147279E21}]
// Microsoft.VisualStudio.Services.SccDisplayInformationPackage
[$RootKey$\Packages\{D7BB9305-5804-4F92-9CFE-119F4CB0563B}]
// Microsoft.VisualStudio.TeamFoundation.Lab.LabPcwPluginPackage
[$RootKey$\Packages\{e0910062-da1f-411c-b152-a3fc6392ee1f}]
[$RootKey$\ToolsOptionsPages\Source Control]
[$RootKey$\AutoLoadPackages\{11b8e6d7-c08b-4385-b321-321078cdd1f8}]
// TFS SCC Configuration entries.

     We need comment out or delete some of these lines. Commenting them out worked just fine for me. We need to disable first 12 lines starting with [$RootKey$\. Here how it should look like after you comment them out. I highlighted the ones you need to comment out.

// ********
// Remove unused packages
// ********

// TFS SCC Configuration entries.  The TFS entries block Team Explorer from loading.
// Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage
//[$RootKey$\AutoLoadPackages\{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}]
// Microsoft.VisualStudio.TeamFoundation.Lab
//[$RootKey$\Packages\{17c5d08a-602c-4dfb-82b5-8e0f7f50c9d7}] 
// GitHub Package
//[$RootKey$\Packages\{c3d3dc68-c977-411f-b3e8-03b0dccf7dfc}] 
// Team Foundation Server Provider Package
//[$RootKey$\Packages\{5BF14E63-E267-4787-B20B-B814FD043B38}]
// Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.WitPcwPackage
//[$RootKey$\Packages\{6238f138-0c0c-49ec-b24b-215ee59d84f0}]
// Microsoft.VisualStudio.TeamFoundation.Build.BuildPackage
//[$RootKey$\Packages\{739f34b3-9ba6-4356-9178-ac3ea81bdf47}]
// Microsoft.VisualStudio.TeamFoundation.WorkItemTracking
//[$RootKey$\Packages\{ca39e596-31ed-4b34-aa36-5f0240457a7e}]
// Microsoft.VisualStudio.TeamFoundation
//[$RootKey$\Packages\{b80b010d-188c-4b19-b483-6c20d52071ae}]
// Microsoft.TeamFoundation.Git.Provider.SccProviderPackage
//[$RootKey$\Packages\{7fe30a77-37f9-4cf2-83dd-96b207028e1b}]
// Microsoft.VisualStudio.TeamFoundation.VersionControl.SccPcwPluginPackage
//[$RootKey$\Packages\{1b4f495a-280a-3ba4-8db0-9c9b735e98ce}] 
// Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage
//[$RootKey$\Packages\{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}]
// Visual SourceSafe Provider Package
//[$RootKey$\Packages\{AA8EB8CD-7A51-11D0-92C3-00A0C9138C45}]
// Visual SourceSafe Provider Stub Package
[$RootKey$\Packages\{53544C4D-B03D-4209-A7D0-D9DD13A4019B}]
// Microsoft.VisualStudio.TeamFoundation.Initialization.InitializationPackage
[$RootKey$\Packages\{75DF55D4-EC28-47FC-88AC-BE56203C9012}]
// Team Foundation Server Provider Stub Package
[$RootKey$\Packages\{D79B7E0A-F994-4D4D-8FAE-CAE147279E21}]
// Microsoft.VisualStudio.Services.SccDisplayInformationPackage
[$RootKey$\Packages\{D7BB9305-5804-4F92-9CFE-119F4CB0563B}]
// Microsoft.VisualStudio.TeamFoundation.Lab.LabPcwPluginPackage
[$RootKey$\Packages\{e0910062-da1f-411c-b152-a3fc6392ee1f}]
[$RootKey$\ToolsOptionsPages\Source Control]
[$RootKey$\AutoLoadPackages\{11b8e6d7-c08b-4385-b321-321078cdd1f8}]
// TFS SCC Configuration entries..

      Now, save this file. If you open the file in Admin mode, you shouldn't have any problem. You will get an error If you are not Admin in your machine or if you didn't use the Run As Administrator option when you were opening the file. After saving the successfully, open the SSMS and look for Team menu item on the top menu.


From this point, you can configure the TFS or Git and start using them from SSMS.

4 comments:

  1. I have done exact changes but Teams menu is still not available.

    ReplyDelete
  2. Hi Hasan - thank you for the post. I was able to enable it, but how do I check in code - for example, if I have a stored procedure in the database, how do i check it in now?

    ReplyDelete
  3. I have also done same changes, but Team menu is not showing.

    ReplyDelete
  4. I have also done same changes, but Team menu is not showing

    ReplyDelete