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

7
我有安装有效许可证(Visual Studio 订阅)的 Visual Studio 2019 企业版(VS 2019 16.1.4),一直使用良好。
突然间,当我尝试打开项目或项目中的任何文件时,出现以下错误。

enter image description here

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

enter image description here

当我点击“确定”时,它显示“您还没有安装任何内容”,并且只有安装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 )<---

===================

我开始经常遇到这个问题(每周两次),唯一的解决方法就是每次重新安装。所以现在我将VS降级到了2017版。

我安装了.NET Core SDK 3.0.100-preview6-012264 后,就开始遇到同样的问题了。不幸的是,我强烈感觉那之后某些东西被损坏了。 - Efran Cobisi
1
我的电脑上没有安装 .NET Core SDK 3.x,但我遇到了相同的错误。 - Fırat Esmer
1个回答

2
卸载VS 2019,请按照以下步骤清理已安装的VS并重新安装:
• 检查您的计算机上是否有此文件:"%programfiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe"
• 如果有,请从管理员命令提示符中使用-full参数启动它: InstallCleanup.exe -full
• 如果没有,请手动删除“%programfiles(x86)%\Microsoft Visual Studio\Installer”文件夹
• 重新启动新下载的vs_enterprise.exe(或vs_professional.exe或vs_community.exe...)
• 允许第一步安装安装程序
• 一旦安装程序出现并且您可以看到工作负载选择(.net桌面等),请关闭它
• 转到启动相同的InstallCleanup.exe以清除旧版VS
• 然后重新运行VS安装程序进行安装
请告诉我们这是否对您有用。

感谢您的回复。为了避免上述错误,我手动删除了路径“C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise”下的文件,并安装了最新的VS16.2.x版本。但是现在,在“程序和功能”中,我看到了两个版本的Visual Studio 16.2.x和16.1.x,分别带有相应的安装日期。 - Gopi
看起来VS 2019 16.2已经成功安装了,对吧?只是“程序和功能”显示了16.1和16.2两个实例,您尝试在VS安装后重新启动计算机了吗?如果没有,请尝试一下。 - Sara Liu - MSFT
是的,我能够使用VS 2019 16.2。我已经多次重启了,但是“程序和功能”仍然显示安装了两个实例。 - Gopi
如果您右键单击VS 16.1.x并选择“卸载”,它将弹出安装程序并要求您确认是否卸载VS 2019企业版?我想之前的卸载失败没有完全清除记录,导致了这个显示问题。 - Sara Liu - MSFT
当我尝试更改或卸载VS 16.1.x时,无法卸载,它显示第二个错误图像。请查看更新。突然之间,我在加载项目时收到了该错误消息。 - Gopi
某种方式安装程序已经更新到最新版本,当我们尝试卸载/更改现有版本时,就会出现问题中提到的“更新”错误。如果我忽略这个错误而继续操作,那么就会导致问题中提到的原始错误。 :( - Gopi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接