如何找到vswhere exe路径?

vij*_*jay 2 c# registry visual-studio

用户是否可以在安装visual studio时自定义下面的vswhere.exe路径?

C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

询问此查询的原因是,我使用 vswhere exe 在我的项目中查找 VS2017 & 19 安装路径。

"VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
Run Code Online (Sandbox Code Playgroud)

建议任何其他方式来查找 Vswhere exe 路径。

cow*_*tor 7

来自微软(https://github.com/Microsoft/vswhere/wiki/Installing):

从 Visual Studio 15.2 (26418.1 Preview) 开始vswhere.exe安装在

%ProgramFiles(x86)%\Microsoft Visual Studio\Installer.

%ProgramFiles%在 Windows 10 之前的 32 位程序中使用)。

这是一个将被维护的固定位置。

这意味着%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe无论用户在 Visual Studio 安装程序或 MSBuild Tools 安装程序上选择什么选项,vswhere 都将位于。

请注意,如果您vswhere使用Chocolatey(而不是 VS/MSBuild 安装程序)进行安装,它将位于%ProgramData%\chocolatey\lib\vswhere\tools\vswhere.exe