移除 Visual StudioRemove Visual Studio

如果發生重大錯誤,且無法修復或解除安裝 Visual Studio,您可以執行 InstallCleanup.exe 工具來移除所有已安裝 Visual Studio 2017 或 Visual Studio 2019 執行個體的安裝檔案與產品資訊。If you encounter a catastrophic error and cannot repair or uninstall Visual Studio, you can run the InstallCleanup.exe tool to remove installation files and product information for all installed instances of Visual Studio 2017 or Visual Studio 2019. 只有當修復或解除安裝失敗,且要解除安裝其他 Visual Studio 安裝的功能或其他產品可能也需要修復時,才能執行此工具作為最後手段。Running this tool should be done only as a last resort if repair or uninstall fail, and may uninstall features from other Visual Studio installations or other products that might then also need to be repaired.

在下列指示中,您可以使用具有下列行為的不同命令列參數來執行此工具:In the following instructions, you can run the tool with different command-line switches with the following behavior:

參數Switch 行為Behavior
-i 如果未傳遞其他參數,此參數會是預設值,而且只會移除主要安裝目錄和產品資訊。This switch is the default if no other switch is passed and removes only the main installation directory and product information. 如果在執行 InstallCleanup.exe 工具之後想要重新安裝相同版本,則適合此行為。This behavior is preferable if you intend to reinstall the same version after you run the InstallCleanup.exe tool.
-f 指定此參數會移除主要安裝目錄、產品資訊,以及安裝在安裝目錄外部但可能與其他 Visual Studio 安裝或其他產品共用的大多數其他功能。Specifying this switch removes the main installation directory, product information, and most other features installed outside the installation directory that may be shared with other Visual Studio installations or other products. 如果想要移除 Visual Studio 且稍後不會重新安裝,則適合此行為。This behavior is preferable if you intend to remove Visual Studio without reinstalling later.
  1. 關閉 Visual Studio 安裝程式。Close the Visual Studio Installer.

  2. 開啟系統管理員命令提示字元。Open an administrator command prompt. 若要開啟系統管理員命令提示字元,請遵循下列步驟:To open an administrator command prompt, follow these steps:

    • 於 [在這裡輸入要搜尋的文字] 方塊中鍵入 cmdType cmd in the "Type here to search" box.
    • 以滑鼠右鍵按一下 [命令提示字元],然後按一下 [以系統管理員身分執行]。Right-click Command Prompt, and then click Run as administrator.
  3. 輸入 InstallCleanup.exe 公用程式的完整路徑,並傳遞您想要的任何命令列參數。Type the full path of the InstallCleanup.exe utility and pass whichever command-line switch you desire. 根據預設,公用程式的路徑如下所示:By default, the path of the utility is as follows:

    C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe
    

如果您在 Visual Studio 安裝程式目錄下找不到 InstallCleanup.exe (一律位於 %ProgramFiles(x86)%\Microsoft Visual Studio),請遵循指示安裝 Visual Studio,並在工作負載選擇畫面顯示時關閉視窗,並再次執行上述步驟。If you do not find InstallCleanup.exe under the Visual Studio Installer directory - always located at %ProgramFiles(x86)%\Microsoft Visual Studio - follow the instructions to install Visual Studio and when the workload selection screen is displayed, close the window and follow the preceding steps again.

取得支援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