Use Visual Studio 2022 as merge tool in Tower

Tower recently released a major upgrade of it's already outstanding Git Client. Microsoft shipped Visual Studio 2022 not too long ago either. This is how you integrate the two.

I've been using Tower as my Git client in Windows for quite a while now, it's great in many aspects, but it doesn't ship with any Diff/Merge capabilities. It relies on 3rd party tool to supply that feature. It comes with a long list of supported tools, but my two default editor isn't part of that list: Visual Studio.

To enable Visual Studio 2017 to 2022 in Tower all you need to do is put the following file here %LOCALAPPDATA%\fournova\Tower\Settings\CompareTools\vs2022.json:

{
  "DisplayName": "Visual Studio 2017-2022",
  "MinimumVersion": "",
  "SupportsDiffChangeset": true,
  "SupportsDirectoryDiff": false,
  "DiffToolArguments": "$LOCAL $REMOTE //t",
  "MergeToolArguments": "$REMOTE $LOCAL $BASE $MERGED //m",
  "ApplicationRegistryIdentifiers": [],
  "ApplicationPaths": [
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Preview\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Preview\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Preview\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Preview\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles%\\Microsoft Visual Studio\\2022\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Preview\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Preview\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Preview\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Preview\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Preview\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\Preview\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\Preview\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\Preview\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\Preview\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe",
    "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\TeamExplorer\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsDiffMerge.exe"
  ]
}

It should automatically detect the Enterprise, Professional or Community Edition of Visual Studio 2017, 2019, 2022 including previews or the stand-alone installation of Team Explorer.

Note: Visual Studio 2022 is now an x64 application and is installed under c:\Program Files now, no longer under c:\Program Files (x86).

Make sure you update your preferences in Tower to select it (you need to restart Tower to detect your custom merge tool changes):

Select Visual Studio 2017-2022 as your Diff and Merge tool.

Due to changes in how Microsoft stores the Installation Path it's not easy to grab this from the registry, so if you're not using the default installation path, you may need to update the search paths above.

Visual Studio not your tool of choice? It's pretty straightforward to add your own!

Photo Credits: Phil Dolby.

Leave a comment.