有谁知道是否可以使用EnvDTE或任何其他方法将条目添加到Visual Studio 2017的“外部工具”菜单?到目前为止,我发现的唯一一件事是添加一些似乎不适用于VS2017的注册表项。以编程方式将条目添加到Visual Studio 2017的“外部工具”菜单中
1
A
回答
2
回答我的问题...
在评论这个问题的自Axel肯珀环节终于把我带到这个SO answer这给出了一个非常简单的方法添加到外部工具列表中的条目。
基本上,您可以在IDE中生成所需的工具,并使用“工具|导入和导出设置”将相应的设置导出到xml文件。在我的情况下,我得到以下内容:
<UserSettings>
<ApplicationIdentity version="15.0"/>
<ToolsOptions/>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_ExternalTools" Category="{E8FAE9E8-FBA2-4474-B134-AB0FFCFB291D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_ExternalTools" PackageName="Visual Studio Environment Package">
<ExternalTools>
<UserCreatedTool>
<Arguments>upload</Arguments>
<CloseOnExit>true</CloseOnExit>
<Command>c:\toolchain\make\make.exe</Command>
<InitialDirectory>$(ProjectDir)</InitialDirectory>
<IsGUIapp>false</IsGUIapp>
<NameID>0</NameID>
<Package>{00000000-0000-0000-0000-000000000000}</Package>
<PromptForArguments>false</PromptForArguments>
<SaveAllDocs>true</SaveAllDocs>
<Title>neuteensy</Title>
<Unicode>false</Unicode>
<UseOutputWindow>true</UseOutputWindow>
<UseTaskList>false</UseTaskList>
</UserCreatedTool>
</ExternalTools>
</Category>
</Category>
</UserSettings>
如有必要,很容易手动或以编程方式调整文件中的设置。
您可以将文件传递给用户进行手动导入,也可以使用envDTE自动导入该文件,如链接答案中所示。
+0
这工作。按照描述导出工具设置,编辑XML以删除除导入选项以外的所有选项(因为默认情况下会导出工具列表中的所有条目)。然后使用DTE导入。其他详细信息在这里:https://stackoverflow.com/a/34328236/3063884 – CJBS
1
作为替代,我写了下面的cmd.exe
脚本加载和访问的Visual Studio 2017年的私人注册表:
@echo off
::
:: vsExtTools.cmd - Script to list external tools of Visual Studio 2017
::
:: Axel Kemper 29-Jul-2017 1st draft
::
setlocal
set VS_VERSION=15.0
set VS_APP_ROOT=%localappdata%\Microsoft
set DEBUG=1
set DEBUG=0
:: The RootSuffix for a normal VS installation will be blank.
:: This is mostly used for the experimental instance
:: cf https://blog.agchapman.com/updating-registry-settings-for-visual-studio-2017/
set ROOT_SUFFIX=
call :findVSInstance %VS_APP_ROOT%\VisualStudio\%VS_VERSION% %ROOT_SUFFIX%
set REG_FILE=%VS_INSTANCE%\privateregistry.bin
if not exist "%REG_FILE%" goto no_reg
set HIVE_ROOT=HKLM\vsHive
call :trace Temporary registry hive %HIVE_ROOT%
:: administrative privileges are needed to load a hive
call :checkAdminRights
if [%IS_ADMIN%]==[0] goto xit
call :trace Loading registry hive from %REG_FILE%
reg.exe load %HIVE_ROOT% "%REG_FILE%"
call :trace %HIVE_ROOT%
reg.exe QUERY "%HIVE_ROOT%\Software\Microsoft\VisualStudio\%VS_HIVE%\External Tools" /s
:: Then you can use reg.exe to manipulate the hive
call :trace Unloading registry hive
reg.exe unload %HIVE_ROOT%
goto xit
:: ====================================================================
:findVSInstance
set VS_INSTANCE=
for /D %%D in (%1_*%2) do set VS_INSTANCE=%%D
for /D %%D in (%1_*%2) do set VS_HIVE=%%~nxD
call :trace VS Instance %VS_INSTANCE%
call :trace VS Hive %VS_HIVE%
goto :EOF
:: ====================================================================
:checkAdminRights
set IS_ADMIN=1
AT > NUL
IF %ERRORLEVEL% EQU 0 goto gotAdmin
call :grumble This script requires administrative privileges!
set IS_ADMIN=0
:gotAdmin
goto :EOF
:: ====================================================================
:grumble
echo.
echo %*
echo.
goto :EOF
:: ====================================================================
:no_reg
call :grumble Visual Studio %VS_VERSION% instance directory not found!
goto :xit
:: ====================================================================
:trace
if [%DEBUG%]==[1] (
echo %*
)
goto :EOF
:: ====================================================================
:xit
endlocal
pause
此版本需要管理员权限,只是列出了External Tool
设置。可以添加对reg.exe
的调用以创建新的工具设置条目。
相关问题
- 1. 以编程方式将项目添加到菜单条?
- 2. 以编程方式将引用添加到Visual Studio项目
- 3. 如何将菜单添加到Visual Studio中的工具?
- 4. 无法将EntityFrameworkCore工具添加到Visual Studio 2017中的类库
- 5. 以编程方式将菜单+项目添加到NSPopupButton
- 6. Drupal以编程方式将项目添加到菜单
- 7. 以编程方式将多个项目添加到Visual Studio解决方案中?
- 8. 如何以编程方式将文件添加到C++的Visual Studio项目中?
- 9. 以编程方式将工具栏添加到Android中的RelativeView
- 10. 将菜单添加到加载项中的Visual Studio菜单栏
- 11. 添加外部头到Visual Studio项目
- 12. 以编程方式添加菜单
- 13. 以编程方式在Visual Studio项目文件中添加和编辑目标
- 14. 以编程方式将新菜单项添加到菜单项PyGObject中?
- 15. 在导航视图中以编程方式将项目添加到菜单组
- 16. PowerShell脚本自动添加Visual Studio“外部工具...”菜单选项?
- 17. 如何以编程方式将行添加到Visual Studio中的rdlc报表中
- 18. Android将按钮以编程方式添加到工具栏
- 19. 以编程方式将UILabel添加到工具栏
- 20. 如何以编程方式将UIButton添加到工具栏上?
- 21. 如何以编程方式将工具栏添加到LinearLayout
- 22. 以编程方式添加工具栏的UIToolbar外观
- 23. 无法添加EntityFrameworkCore工具1.0.1到类库在Visual Studio 2017年
- 24. 以编程方式将菜单项/链接添加到Drupal菜单?
- 25. Visual Studio将OvalShape和RectangleShape工具引用添加到项目中
- 26. 如何以编程方式将文件添加到Visual Studio模板?
- 27. 如何将控件(以编程方式)添加到Visual Studio设计器中WinForm
- 28. 以编程方式将Visual Studio 2012连接到TFS 2012
- 29. 以编程方式添加动作栏菜单项目
- 30. 是否可以将Visual C++ v120编译器工具集添加到Visual Studio 2015?
这是否意味着VS2017正在使用.. \ 14.0 \ External Tools中的密钥?我认为这个注册表分支只能被VS2015读取。 –
我自己并没有掌握,但[这里](https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/extensibility/writing-to-the-user-settings-store.md)你可以找到一个如何访问“用户设置存储”的例子。看起来相当于我。 –
Visual Studio 2017现在将其设置存储在一个私有注册表文件中,而不是在常用的Windows注册表中。看到这[相关文章](https://stackoverflow.com/questions/41119996/where-does-visual-studio-2017-rc-store-its-config) –