Visual Studio 安装和升级问题疑难解答Troubleshoot Visual Studio installation and upgrade issues

重要

安装时遇到问题?Having a problem installing? 我们可以为你提供帮助。We can help. 我们提供安装聊天(仅英语)支持选项。We offer an installation chat (English only) support option.

本疑难解答指南包含可解决大多数安装问题的分步说明。This troubleshooting guide includes step-by-step instructions that should resolve most installation issues.

联机安装Online installations

以下步骤针对典型的联机安装进行了优化。The following steps are optimized for a typical online installation. 有关影响脱机安装的问题,请参阅如何解决脱机安装问题For an issue that affects an offline installation, please see How to troubleshoot an offline installation.

第 1 步 - 检查此问题是否是已知问题Step 1 - Check whether this problem is a known issue

Visual Studio 安装程序存在一些已知问题,Microsoft 正在努力修复中。There are some known issues with the Visual Studio Installer that Microsoft is working on fixing. 若要确定你遇到的问题是否有解决办法,请参阅发行说明的“已知问题”部分To see if there's a workaround for your problem, check the Known Issues section of our release notes.

Visual Studio 安装程序存在一些已知问题,Microsoft 正在努力修复中。There are some known issues with the Visual Studio Installer that Microsoft is working on fixing. 若要确定你遇到的问题是否有解决办法,请参阅发行说明的“已知问题”部分To see if there's a workaround for your problem, check the Known Issues section of our release notes.

第 2 步 - 尝试修复 Visual StudioStep 2 - Try repairing Visual Studio

修复可解决许多常见的更新问题。Repair fixes many common update issues. 若要详细了解何时以及如何在 Visual Studio 中使用修复功能,请参阅修复 Visual StudioFor more information on when and how to use the repair functionality in Visual Studio, see Repair Visual Studio.

第 3 步 - 通过开发人员社区获取帮助Step 3 - Check with the developer community

Visual Studio 开发人员社区中搜索错误消息。Search on your error message with the Visual Studio Developer Community. 社区的其他成员可能已记录下你遇到的问题的解决方案。Other members of the community might have documented a solution to your problem.

第 4 步 - 删除 Visual Studio 安装程序目录以修复升级问题Step 4 - Delete the Visual Studio Installer directory to fix upgrade problems

Visual Studio 安装程序引导程序是最轻型的可执行文件,用于安装 Visual Studio 安装程序的剩余部分。The Visual Studio Installer bootstrapper is a minimal light-weight executable that installs the rest of the Visual Studio Installer. 删除 Visual Studio 安装程序文件,然后重新运行引导程序,可能会修复一些更新故障。Deleting Visual Studio Installer files and then rerunning the bootstrapper might solve some update failures.

备注

执行以下操作将重新安装 Visual Studio 安装程序文件并重置安装元数据。Performing the following actions reinstalls the Visual Studio Installer files and resets the installation metadata.

  1. 关闭 Visual Studio 安装程序。Close the Visual Studio Installer.
  2. 删除 Visual Studio 安装程序目录。Delete the Visual Studio Installer directory. 通常,该目录是 C:\Program Files (x86)\Microsoft Visual Studio\InstallerTypically, the directory is C:\Program Files (x86)\Microsoft Visual Studio\Installer.
  3. 运行 Visual Studio 安装程序引导程序。Run the Visual Studio Installer bootstrapper. 引导程序位于“下载”文件夹中,文件名格式为 vs_[Visual Studio edition]__*.exeYou might find the bootstrapper in your Downloads folder with a file name that follows a vs_[Visual Studio edition]__*.exe pattern. 如果找不到此应用程序,可以转到 Visual Studio 下载页,然后单击你的 Visual Studio 版本所对应的“下载”,便可下载引导程序。If you don't find that application, you can download the bootstrapper by going to the Visual Studio downloads page and clicking Download for your edition of Visual Studio. 然后,运行此可执行文件,重置安装元数据。Then, run the executable to reset your installation metadata.
  4. 尝试重新安装或更新 Visual Studio。Try to install or update Visual Studio again. 如果安装程序仍无法安装,请转到下一步。If the Installer continues to fail, go to the next step.
  1. 关闭 Visual Studio 安装程序。Close the Visual Studio Installer.
  2. 删除 Visual Studio 安装程序目录。Delete the Visual Studio Installer directory. 通常,该目录是 C:\Program Files (x86)\Microsoft Visual Studio\InstallerTypically, the directory is C:\Program Files (x86)\Microsoft Visual Studio\Installer.
  3. 运行 Visual Studio 安装程序引导程序。Run the Visual Studio Installer bootstrapper. 引导程序位于“下载”文件夹中,文件名格式为 vs_[Visual Studio edition]__*.exeYou might find the bootstrapper in your Downloads folder with a file name that follows a vs_[Visual Studio edition]__*.exe pattern. 如果找不到此应用程序,可以转到 Visual Studio 下载页,然后单击你的 Visual Studio 版本所对应的“下载”,便可下载引导程序。If you don't find that application, you can download the bootstrapper by going to the Visual Studio downloads page and clicking Download for your edition of Visual Studio. 然后,运行此可执行文件,重置安装元数据。Then, run the executable to reset your installation metadata.
  4. 尝试重新安装或更新 Visual Studio。Try to install or update Visual Studio again. 如果安装程序仍无法安装,请转到下一步。If the Installer continues to fail, go to the next step.

第 5 步 - 报告问题Step 5 - Report a problem

在某些情况下(如出现与文件损坏相关的问题时),可能需要逐个调查每个问题。In some situations, such as those related to corrupted files, the problems might have to be looked at on a case-by-case basis. 为便于我们为你提供帮助,请执行以下操作:To help us help you, please do the following:

  1. 收集安装日志。Collect your setup logs. 有关详细信息,请参阅如何获取 Visual Studio 安装日志See How to get the Visual Studio installation logs for details.
  2. 打开 Visual Studio 安装程序,然后单击“报告问题”,打开 Visual Studio 反馈工具。Open the Visual Studio Installer, and then click Report a problem to open the Visual Studio Feedback tool. 可以使用 Tab 键定位到“提供反馈”按钮,从而打开反馈工具You can tab to the Provide Feedback button to open the feedback tool
  3. 为问题报告命名一个标题,然后输入相关详细信息。Give your problem report a title, and provide relevant details. 单击“下一步”,转到“附件”部分,然后附加生成的日志文件(此文件通常位于 %TEMP%\vslogs.zip)。Click Next to go to the Attachments section, and then attach the generated log file (typically, the file is at %TEMP%\vslogs.zip).
  4. 单击“下一步”,检查问题报告,然后单击“提交”。Click Next to review your problem report, and then click Submit.
  1. 收集安装日志。Collect your setup logs. 有关详细信息,请参阅如何获取 Visual Studio 安装日志See How to get the Visual Studio installation logs for details.
  2. 打开 Visual Studio 安装程序,然后单击“报告问题”,打开 Visual Studio 反馈工具。Open the Visual Studio Installer, and then click Report a problem to open the Visual Studio Feedback tool. 可以使用 Tab 键定位到“提供反馈”按钮,从而打开反馈工具You can tab to the Provide Feedback button to open the feedback tool
  3. 为问题报告命名一个标题,然后输入相关详细信息。Give your problem report a title, and provide relevant details. 单击“下一步”,转到“附件”部分,然后附加生成的日志文件(此文件通常位于 %TEMP%\vslogs.zip)。Click Next to go to the Attachments section, and then attach the generated log file (typically, the file is at %TEMP%\vslogs.zip).
  4. 单击“下一步”,检查问题报告,然后单击“提交”。Click Next to review your problem report, and then click Submit.

第 6 步 - 运行 InstallCleanup.exe 以删除安装文件Step 6 - Run InstallCleanup.exe to remove installation files

作为最后一种方法,可以删除 Visual Studio 以删除所有安装文件和产品信息。As a last resort, you can remove Visual Studio to remove all installation files and product information.

  1. 按照删除 Visual Studio 中的说明执行。Follow the instructions in Remove Visual Studio.
  2. 按照第 4 步 - 删除 Visual Studio 安装程序目录以修复升级问题中的说明操作,重新运行引导程序。Rerun the bootstrapper that's described in Step 4 - Delete the Visual Studio Installer directory to fix upgrade problems.
  3. 尝试重新安装或更新 Visual Studio。Try to install or update Visual Studio again.

第 7 步 - 与我们联系(可选)Step 7 - Contact us (optional)

如果上述步骤均未帮助你成功安装或升级 Visual Studio,请使用我们的实时聊天支持选项(仅英语)与我们联系,以获取进一步的帮助。If none of the previous steps help you successfully install or upgrade Visual Studio, contact us by using our live chat support option (English only) for further assistance.

脱机安装Offline installations

下面的表格列出了创建脱机安装和通过本地布局进行安装时的已知问题和可能会对你有所帮助的解决办法。Here is a table of known issues and some workarounds that might help you when you create an offline installation and then install from a local layout.

问题Issue Item 解决方案Solution
用户没有访问文件的权限。Users do not have access to files. 权限 (ACL)permissions (ACLs) 请确保调整权限 (ACL),以便他们在共享脱机安装前先向其他用户授予“读取”权限。Make sure that you adjust the permissions (ACLs) so that they grant Read access to other users before you share the offline install.
无法安装新的工作负载、组件或语言。New workloads, components, or languages fail to install. --layout 若要通过部分布局进行安装,并选择之前未在此部分布局中下载过的工作负载、组件或语言,请确保可连接到 Internet。Make sure that you have internet access if you install from a partial layout and select workloads, components, or languages that were not downloaded previously in that partial layout.

有关如何解决网络安装问题的详细信息,请参阅安装或使用 Visual Studio 时与网络相关错误的疑难解答For more information about how to resolve issues with a network installation, see Troubleshoot network-related errors when you install or use Visual Studio.

安装日志Installation logs

若要排查大部分的安装问题,需要有安装日志。Setup logs are needed to troubleshoot most installation issues. 使用 Visual Studio 安装程序中的报告问题提交问题时,这些日志会自动添加到报告中。When you submit an issue by using Report a Problem in the Visual Studio Installer, these logs are automatically included in your report.

如果联系 Microsoft 支持部门,可能需要使用 Microsoft Visual Studio 和 .NET Framework 日志收集工具来提供这些安装日志。If you contact Microsoft Support, you might need to provide these setup logs by using the Microsoft Visual Studio and .NET Framework Log Collection Tool. 日志收集工具从 Visual Studio 安装的所有组件(包括 .NET Framework、Windows SDK 和 SQL Server)收集安装日志。The log collection tool collects setup logs from all components installed by Visual Studio, including .NET Framework, Windows SDK, and SQL Server. 它还会收集计算机信息、Windows Installer 清单,以及 Visual Studio 安装程序、Windows Installer 和系统还原的 Windows 事件日志信息。It also collects computer information, a Windows Installer inventory, and Windows event log information for Visual Studio Installer, Windows Installer, and System Restore.

收集日志的具体步骤:To collect the logs:

  1. 下载工具Download the tool.
  2. 打开管理命令提示符。Open an administrative command prompt.
  3. 从工具保存目录运行 Collect.exeRun Collect.exe from the directory where you saved the tool.
  4. %TEMP% 目录中查找生成的 vslogs.zip 文件,例如,C:\Users\YourName\AppData\Local\Temp\vslogs.zipFind the resulting vslogs.zip file in your %TEMP% directory, for example, C:\Users\YourName\AppData\Local\Temp\vslogs.zip.

备注

工具必须在安装失败时使用的同一用户帐户下运行。The tool must be run under the same user account that the failed installation was run under. 若要从其他用户帐户运行工具,请设置 –user:<name> 选项,以指定安装失败时使用的用户帐户。If you are running the tool from a different user account, set the –user:<name> option to specify the user account under which the failed installation was run. 有关其他选项和使用情况信息,请通过管理员命令提示符运行 Collect.exe -? 获取。Run Collect.exe -? from an administrator command prompt for additional options and usage information.

实时帮助Live help

如果本疑难解答指南中列出的解决方案无法帮助你成功安装或升级 Visual Studio,请使用我们的实时聊天支持选项(仅英语)以获取进一步的帮助。If the solutions listed in this troubleshooting guide do not help you to successfully install or upgrade Visual Studio, use our live chat support option (English only) for further assistance.

请参阅See also