External Tools in Visual Studio 2017 and higher

Back in 2011, I wrote the post Programmatically Add External Tool to Visual Studio and sketched, how Visual Studio stores its External Tools in the registry unter

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VersionNumber]\External Tools\

Recently a reader asked

Is this capability still available in Visual Studio 2019

which got me researching.

Indeed, VS 2017 and 2019 do not seem to have the same registry trees as versions up to 14.0 (VS 2015) have.

I searched the registry and %ProgramData% and %AppData% for the well-known external tool GuidGen.exe, but did not immediately find anything useful.

What I did find, was that the configuration file for the WebCode persona of VS (C:\Program Files\Microsoft Visual Studio\2017\Community\Common7\IDE\Profiles\WebCode.vssettings) contains the section

<Category name="Environment_ExternalTools"  ...>
    <ExcludeRegisteredTool SourceKeyName="Create GUID"/>

Aha, so there are “Registered Tools”. But how are they registered, and where?

Next, I found the registration file for guidgen.exe (C:\Program Files\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\External Tools\GuidGen\GuidGen.pkgdef), which almost looks like a .reg Registry file

[$RootKey$\External Tools\Create GUID]

but what is $RootKey$? Certainly a macro evaluated during installation, but where does the registry key end up?

Another search brought me to this answer on SO, stating

In Visual Studio 2017, External Tools are stored in a private registry hive in the user’s local application data folder

along with source code how to find and open the private registry hive depending on the VS version.

I started up VS 2017 and VS 2019 and created a dummy External Tool called “Test Cmd” for cmd.exe, and tried to find the name in my local AppData directory.

Indeed I found the entry in the file

  <Title>Test Cmd Edited</Title>

I manually copied this entry under a different <Title>, started up VS, and found the copied entry being displayed in the Tools menu.

I did not check where the private registry hive is updated to reflect the changes in the CurrentSettings file, but it seems that changing the file manually or programmatically (while VS is not running) is sufficient to register an external tool.

1 thought on “External Tools in Visual Studio 2017 and higher

  1. Pingback: VS Solution Dependency Visualizer supports .NET Core Project Files | devioblog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.