Visual Studio 安装程序缺少选项值:InstallPath - Visual Studio 2019

Gop*_*opi 6 installation corrupt visual-studio visual-studio-2019

我安装了带有有效许可证(Visual Studio 订阅)的 Visual Studio 2019 企业版(VS 2019 16.1.4)并且运行良好。

突然间,当我尝试打开一个项目或该项目的任何文件时,我收到以下错误。

在此处输入图片说明

所以我尝试使用 Visual Studio Uninstaller 卸载,当我选择卸载程序时,它会自动更新,当我现在打开卸载程序时,它说

在此处输入图片说明

当我单击“确定”时,它说您还没有安装任何东西,它只有安装 VS 2019 16.2.0 的选项。

即使我尝试安装 VS 2019 16.2.0 ,我也会看到错误

“无法将 Visual Studio 安装到非空目录 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise'。”

请帮助我解决错误。

更新

=====================
12-08-2019 06:31:09 PM
Recoverable
System.AggregateException: One or more errors occurred. ---> System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490)
   at Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.GetInstanceForCurrentProcess()
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<IsPrereleaseAsync>d__44.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<IsPreviewSDKInUseAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<CheckCompatibilityAsync>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<<InitializeAsync>b__40_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.<>c__DisplayClass32_1.<<Fork>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Runtime.InteropServices.COMException (0x80070490): Element not found. (Exception from HRESULT: 0x80070490)
   at Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.GetInstanceForCurrentProcess()
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<IsPrereleaseAsync>d__44.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<IsPreviewSDKInUseAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<CheckCompatibilityAsync>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.DotNetCoreProjectCompatibilityDetector.<<InitializeAsync>b__40_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.<>c__DisplayClass32_1.<<Fork>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )<---

===================
Run Code Online (Sandbox Code Playgroud)

我开始非常频繁地遇到这个问题(每周两次),唯一的解决方案是每次都重新安装。所以暂时将VS降级到2017年。

Sar*_*SFT 2

要卸载 VS 2019,请按照以下步骤清理已安装的 VS 并重新安装:

\n\n

\xe2\x80\xa2 查看计算机上是否有此文件:“%programfiles(x86)%\\Microsoft Visual Studio\\Installer\\resources\\app\\layout\\InstallCleanup.exe”

\n\n

\xe2\x80\xa2 如果是这样,请使用 -full 参数从管理命令提示符启动它:\nInstallCleanup.exe -full

\n\n

\xe2\x80\xa2 如果没有,请手动删除“%programfiles(x86)%\\Microsoft Visual Studio\\Installer\xe2\x80\x9d 文件夹

\n\n

\xe2\x80\xa2 重新启动新下载的 vs_enterprise.exe(或 vs_professional.exe 或 vs_community.exe\xe2\x80\xa6)

\n\n

\xe2\x80\xa2 允许第一步安装安装程序

\n\n

\xe2\x80\xa2 安装程序出现后,您可以看到工作负载选择(.net 桌面等),将其关闭

\n\n

\xe2\x80\xa2 启动相同的 InstallCleanup.exe 来清理 VS 的旧版本

\n\n

\xe2\x80\xa2 然后重新运行VS安装程序进行安装

\n\n

请告诉我们这是否适合您。

\n