用於偵測及管理 Visual Studio 執行個體的工具Tools for detecting and managing Visual Studio instances

有數個工具,您可以使用來偵測用戶端電腦上的 Visual Studio 安裝,以及管理安裝。There are several tools that you can use to detect Visual Studio installations on client machines, and to manage the installations, too.

偵測現有的 Visual Studio 執行個體Detecting existing Visual Studio instances

我們提供數種工具來協助您偵測及管理用戶端電腦上已安裝的 Visual Studio 執行個體︰We have made several tools available that will help you detect and manage installed Visual Studio instances on client machines:

  • vswhere (英文):這個內建於 Visual Studio 中,也能以個別發佈方式取得的可執行檔,可協助您在特定機器上找到所有 Visual Studio 執行個體的位置。vswhere: an executable built into Visual Studio or available for separate distribution that helps you find the location of all Visual Studio instances on a particular machine.
  • VSSetup.PowerShell:PowerShell 指令碼,使用安裝程式組態 API 來識別已安裝的 Visual Studio 執行個體。VSSetup.PowerShell: PowerShell scripts that use the Setup Configuration API to identify installed instances of Visual Studio.
  • VS-Setup-Samples:C# 和 C++ 範例,示範如何使用安裝程式組態 API 來查詢現有安裝。VS-Setup-Samples: C# and C++ samples that demonstrate how to use the Setup Configuration API to query an existing installation.

此外,安裝程式組態 API 還提供介面,讓想要建置其專屬公用程式的開發人員查閱 Visual Studio 執行個體。In addition, the Setup Configuration API provides interfaces for developers who want to build their own utilities for interrogating Visual Studio instances.

使用 vswhere.exeUsing vswhere.exe

vswhere.exe 自動包含在 Visual Studio (Visual Studio 2017 15.2 版與更新版本) 中,或您也可以從 vswhere 發行頁面 (英文) 下載。vswhere.exe is automatically included in Visual Studio (starting with Visual Studio 2017 version 15.2 and later versions), or you can download it from the vswhere releases page. 使用 vswhere -? 來取得該工具的說明資訊。Use vswhere -? to get help information about the tool. 作為範例,此命令會顯示 Visual Studio 的所有版本 (包括產品的較舊版本及發行前版本),並以 JSON 格式輸出結果:As an example, this command shows all releases of Visual Studio, including earlier versions of the product and prereleases, and outputs the results in JSON format:

C:\Program Files (x86)\Microsoft Visual Studio\Installer> vswhere.exe -legacy -prerelease -format json

Tip

如需 Visual Studio 2017 安裝的詳細資訊,請參閱 Visual Studio Setup Archives (Visual Studio 安裝封存)。For more information about Visual Studio 2017 installation, see Visual Studio Setup Archives.

編輯 Visual Studio 執行個體的登錄Editing the registry for a Visual Studio instance

在 Visual Studio 中,登錄設定會儲存在私人位置,這可在相同電腦上啟用 Visual Studio 相同版本的多個並存執行個體。In Visual Studio, registry settings are stored in a private location, which enables multiple side-by-side instances of the same version of Visual Studio on the same machine.

因為這些項目不是儲存在全域登錄中,針對使用登錄編輯程式來變更登錄設定有一些特殊指示︰As these entries are not stored in the global registry, there are special instructions for using the Registry Editor to make changes to registry settings:

  1. 如果您有開啟的 Visual Studio 執行個體,請將其關閉。If you have an open instance of Visual Studio, close it.

  2. 啟動 regedit.exeStart regedit.exe.

  3. 選取 HKEY_LOCAL_MACHINE 節點。Select the HKEY_LOCAL_MACHINE node.

  4. 從 Regedit 主功能表選取 [檔案] > [載入登錄區],然後選取私人登錄檔 (儲存在 AppData\Local 資料夾中)。From the Regedit main menu, select File > Load Hive... and then select the private registry file, which is stored in the AppData\Local folder. 例如:For example:

    %localappdata%\Microsoft\VisualStudio\<config>\privateregistry.bin
    

    Note

    <config> 對應至您想要瀏覽的 Visual Studio 執行個體。<config> corresponds to the instance of Visual Studio that you would like to browse.

系統將會提示您提供登錄區名稱,這會變成您的已隔離登錄區的名稱。You will be prompted to provide a hive name, which becomes the name of your isolated hive. 這麼做之後,您應該能在您所建立的已隔離登錄區下瀏覽登錄。After you do so, you should be able to browse the registry under the isolated hive that you created.

Important

在重新啟動 Visual Studio 之前,必須卸載您所建立的已隔離登錄區。Before you start Visual Studio again, you must unload the isolated hive that you created. 若要執行此操作,請從 Regedit 主功能表選取 [檔案] > [解除載入登錄區]。To do this, select File > Unload Hive from the Regedit main menu. (如果您沒有這麼做,則檔案會維持鎖定且 Visual Studio 將無法啟動)。(If you do not do this, then the file remains locked and Visual Studio will not be able to start.)

取得支援Get support

有時可能會發生一些問題。Sometimes, things can go wrong. 若 Visual Studio 安裝失敗,請參閱針對 Visual Studio 安裝和升級問題進行疑難排解,以取得逐步指導方針。If your Visual Studio installation fails, see Troubleshoot Visual Studio installation and upgrade issues for step-by-step guidance.

我們也提供即時聊天 (僅限英文) 支援選項,可回答有關安裝的相關問題。We also offer a live chat (English only) support option for installation-related issues.

以下是一些支援選項:Here are a few more support options:

另請參閱See also