We want to deploy some external tools to Visual Studio for our developers. Is there a way to automate it through a script or similar or should all of them do it manually?
Asked
Active
Viewed 2,472 times
2 Answers
3
For Visual Studio 2013, the external tools are managed in the registry at
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\External Tools
You should be able to write a registry script to add what you need. Make sure to backup the registry before any updating.

rrirower
- 4,338
- 4
- 27
- 45
-
Ops ... it requires some intelligence as it has to check how many tools are already added ... too complex for a busy man ... manual instructions :) – Ignacio Soler Garcia Feb 03 '15 at 14:11
1
A bit late, but I stumbled upon this question while looking for the same thing, and ended up writing a batch file that identifies new available tool number.
Set desired VS versions comma separated (works up to VS 2015 - 14.0, VS 2017 uses private registry - see this post) , and the parameters for the tool in the beginning of the file.
@echo off
echo.
rem ========================================
rem Configure desired Tool values and desired VS Versions (tested only for 14.0, other should be the same)
rem ========================================
set VSVersions=13.0,14.0
set ToolTitle=Abrir prompt testes front-end...
set ToolCmd=$(SolutionDir)\FrontendTestsPrepare.bat
set ToolDir=$(SolutionDir)
set ToolOpt=0x12
set ToolArg=
set ToolSourceKey=
rem ========================================
rem Logic begins
rem ========================================
for %%a in ("%VSVersions:,=" "%") do (
CALL:REGISTER_TOOL %%~a
)
exit /b
:REGISTER_TOOL
set VSToolRegKey=HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\%1\External Tools
echo Registering tool for VS %1
rem ========================================
rem Gets and sets tool count and new index
rem ========================================
CALL:GETTOOLCOUNT "%VSToolRegKey%"
set ToolCount=%ERRORLEVEL%
echo Tool Index: %ToolCount%
set NewToolIndex=%ToolCount%
set /a NewToolCount=%ToolCount%+1
rem ========================================
rem Update Tool Count
rem ========================================
reg add "%VSToolRegKey%" /v ToolNumKeys /f /t REG_DWORD /d 0x%NewToolCount%
rem ========================================
rem Creates
rem ========================================
reg add "%VSToolRegKey%" /v ToolTitle%NewToolIndex% /d "%ToolTitle%"
reg add "%VSToolRegKey%" /v ToolCmd%NewToolIndex% /d "%ToolCmd%"
reg add "%VSToolRegKey%" /v ToolDir%NewToolIndex% /d "%ToolDir%"
reg add "%VSToolRegKey%" /v ToolOpt%NewToolIndex% /d %ToolOpt% /t REG_DWORD
reg add "%VSToolRegKey%" /v ToolArg%NewToolIndex% /d "%ToolArg%"
reg add "%VSToolRegKey%" /v ToolSourceKey%NewToolIndex% /d "%ToolSourceKey%"
echo.
echo.
GOTO :EOF
:GETTOOLCOUNT
set ToolCount=0
set RegQueryOutput=
rem Tests if registry path exists, returning 1 if not
reg query %1 /f ToolNumKeys /v > nul 2>&1
IF NOT %ERRORLEVEL%==0 exit /b %ToolCount%
rem Gets tool count from reg query output
for /f "tokens=*" %%i in ('reg query %1 /f ToolNumKeys /v ^| findstr "0x.*"') do set RegQueryOutput=%%i
for /F "tokens=3 delims= " %%E in ("%RegQueryOutput%") do set ToolCount=%%E
set ToolCount=%ToolCount:0x=%
exit /b %ToolCount%
The flags that can be or'ed together in "ToolOpt" are the following (extracted from here):
#define TOOLOPT_ISAPPGUI 0x01
#define TOOLOPT_CLOSEONEXIT 0x02
#define TOOLOPT_PROMPTFORARGS 0x04
#define TOOLOPT_USEOUTPUTWIN 0x08
#define TOOLOPT_SAVEALLDOCS 0x10
#define TOOLOPT_USETASKLIST 0x20
#define TOOLOPT_UNICODE 0x40

Renato Chencinski
- 405
- 4
- 9