无法(卸载)安装 Visual Studio 2017

问题描述:

我在升级 VS2017 时遇到了严重的问题,因为它在我升级时进入了不一致的状态.有一些残余软件包拒绝卸载,因为它们显然缺少 C:\Windows\Installer 文件夹中的缓存文件.我从来没有碰过那个文件夹.但是,我确实使用软连接 (mklink/D)

I'm having serious issues getting VS2017 latest to run as it has gone into an inconsistent state while I was upgrading it. There are a few remnant packages that refuse to uninstall as they are apparently missing cached files from C:\Windows\Installer folder. I never touched that folder. I did, however, moved the C:\ProgramData\Packages Cache and Visual Studio folders to another drive using soft junctions (mklink /D)

现在,即使卸载 VS2017 后,我也无法重新安装它,因为它立即失败并报告:

Now, even after uninstalling VS2017, I cannot re-install it as it fails immediately reporting that:

The product failed to install the listed workloads and components due to one or more package failures.

Incomplete workloads
    .NET Core cross-platform development (Microsoft.VisualStudio.Workload.NetCoreTools,version=15.0.26127.0)
    .NET desktop development (Microsoft.VisualStudio.Workload.ManagedDesktop,version=15.0.26206.0)
    ASP.NET and web development (Microsoft.VisualStudio.Workload.NetWeb,version=15.0.26206.0)
    Node.js development (Microsoft.VisualStudio.Workload.Node,version=15.0.26206.0)
    Visual Studio core editor (Microsoft.VisualStudio.Workload.CoreEditor,version=15.0.26004.1)

Incomplete components
    .NET desktop development tools (Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites,version=15.0.26109.1)
    .NET Framework 4.6.1 development tools (Microsoft.Net.ComponentGroup.DevelopmentPrerequisites,version=15.0.26206.0)
    .NET Portable Library targeting pack (Microsoft.VisualStudio.Component.PortableLibrary,version=15.0.26109.1)
    ASP.NET and web development tools (Microsoft.VisualStudio.Component.Web,version=15.0.26127.0)
    Blend for Visual Studio (Microsoft.ComponentGroup.Blend,version=15.0.26004.1)
    Blend for Visual Studio SDK for .NET (Microsoft.Component.Blend.SDK.WPF,version=15.0.26004.1)
    C# and Visual Basic (Microsoft.VisualStudio.Component.Roslyn.LanguageServices,version=15.0.26109.1)
    ClickOnce Publishing (Microsoft.Component.ClickOnce,version=15.0.26004.1)
    Cloud Explorer (Microsoft.VisualStudio.Component.CloudExplorer,version=15.0.26206.0)
    Connectivity and publishing tools (Microsoft.VisualStudio.Component.Common.Azure.Tools,version=1.9.170119.3)
    Container development tools (Microsoft.VisualStudio.Component.DockerTools,version=15.0.26206.0)
    Data sources and service references (Microsoft.VisualStudio.Component.VisualStudioData,version=15.0.26004.1)
    Data sources for SQL Server support (Microsoft.VisualStudio.Component.SQL.DataSources,version=15.0.26004.1)
    Developer Analytics tools (Microsoft.VisualStudio.Component.AppInsights.Tools,version=15.0.26206.0)
    Entity Framework 6 tools (Microsoft.VisualStudio.Component.EntityFramework,version=15.0.26004.1)
    IIS Express  (Microsoft.VisualStudio.Component.IISExpress,version=15.0.26004.1)
    IntelliTrace (Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd,version=15.0.26004.1)
    JavaScript and TypeScript language support (Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26004.1)
    JavaScript diagnostics (Microsoft.VisualStudio.Component.JavaScript.Diagnostics,version=15.0.26109.1)
    Just-In-Time debugger (Microsoft.VisualStudio.Component.Debugger.JustInTime,version=15.0.26109.1)
    Live Unit Testing (Microsoft.VisualStudio.Component.LiveUnitTesting,version=15.0.26206.0)
    Managed Desktop Workload Core (Microsoft.VisualStudio.Component.ManagedDesktop.Core,version=15.0.26109.1)
    Modeling SDK (Microsoft.VisualStudio.Component.DslTools,version=15.0.26109.1)
    Node.js support (Microsoft.VisualStudio.Component.Node.Tools,version=15.0.26206.0)
    NuGet package manager (Microsoft.VisualStudio.Component.NuGet,version=15.0.26004.1)
    Profiling tools (Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26109.1)
    SQL Server Data Tools (Microsoft.VisualStudio.Component.SQL.SSDT,version=15.0.26206.0)
    Text Template Transformation (Microsoft.VisualStudio.Component.TextTemplating,version=15.0.26004.1)
    Visual Studio core editor (Microsoft.VisualStudio.Component.CoreEditor,version=15.0.26004.1)
    Visual Studio SDK (Microsoft.VisualStudio.Component.VSSDK,version=15.0.26206.0)
    Web Deploy (Microsoft.VisualStudio.Component.WebDeploy,version=15.0.26004.1)
    WebSocket4Net (Component.WebSocket,version=15.0.26109.1)
    Windows Communication Foundation (Microsoft.VisualStudio.Component.Wcf.Tooling,version=15.0.26109.1)

You can search for solutions using the information below, modify your selections for the above workloads and components and retry the installation, or remove the product from your machine.

Following is a collection of individual package failures that led to the incomplete workloads and components above. To search for existing reports of these specific problems, please copy and paste the URL from each package failure into a web browser. If the issue has already been reported, you can find solutions or workarounds there. If the issue has not been reported, you can create a new issue where other people will be able to find solutions or workarounds.

Package 'Microsoft.VisualStudio.MinShell.Msi,version=15.0.26206.0' failed to install.
    Search URL: https://aka.ms/VSSetupErrorReports?q=PackageId=Microsoft.VisualStudio.MinShell.Msi;PackageAction=Install;ReturnCode=1714
    Impacted workloads
        .NET Core cross-platform development (Microsoft.VisualStudio.Workload.NetCoreTools,version=15.0.26127.0)
        .NET desktop development (Microsoft.VisualStudio.Workload.ManagedDesktop,version=15.0.26206.0)
        ASP.NET and web development (Microsoft.VisualStudio.Workload.NetWeb,version=15.0.26206.0)
        Node.js development (Microsoft.VisualStudio.Workload.Node,version=15.0.26206.0)
        Visual Studio core editor (Microsoft.VisualStudio.Workload.CoreEditor,version=15.0.26004.1)
    Impacted components
        .NET desktop development tools (Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites,version=15.0.26109.1)
        .NET Framework 4.6.1 development tools (Microsoft.Net.ComponentGroup.DevelopmentPrerequisites,version=15.0.26206.0)
        .NET Portable Library targeting pack (Microsoft.VisualStudio.Component.PortableLibrary,version=15.0.26109.1)
        ASP.NET and web development tools (Microsoft.VisualStudio.Component.Web,version=15.0.26127.0)
        Blend for Visual Studio (Microsoft.ComponentGroup.Blend,version=15.0.26004.1)
        Blend for Visual Studio SDK for .NET (Microsoft.Component.Blend.SDK.WPF,version=15.0.26004.1)
        C# and Visual Basic (Microsoft.VisualStudio.Component.Roslyn.LanguageServices,version=15.0.26109.1)
        ClickOnce Publishing (Microsoft.Component.ClickOnce,version=15.0.26004.1)
        Cloud Explorer (Microsoft.VisualStudio.Component.CloudExplorer,version=15.0.26206.0)
        Connectivity and publishing tools (Microsoft.VisualStudio.Component.Common.Azure.Tools,version=1.9.170119.3)
        Container development tools (Microsoft.VisualStudio.Component.DockerTools,version=15.0.26206.0)
        Data sources and service references (Microsoft.VisualStudio.Component.VisualStudioData,version=15.0.26004.1)
        Data sources for SQL Server support (Microsoft.VisualStudio.Component.SQL.DataSources,version=15.0.26004.1)
        Developer Analytics tools (Microsoft.VisualStudio.Component.AppInsights.Tools,version=15.0.26206.0)
        Entity Framework 6 tools (Microsoft.VisualStudio.Component.EntityFramework,version=15.0.26004.1)
        IIS Express  (Microsoft.VisualStudio.Component.IISExpress,version=15.0.26004.1)
        IntelliTrace (Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd,version=15.0.26004.1)
        JavaScript and TypeScript language support (Microsoft.VisualStudio.Component.JavaScript.TypeScript,version=15.0.26004.1)
        JavaScript diagnostics (Microsoft.VisualStudio.Component.JavaScript.Diagnostics,version=15.0.26109.1)
        Just-In-Time debugger (Microsoft.VisualStudio.Component.Debugger.JustInTime,version=15.0.26109.1)
        Live Unit Testing (Microsoft.VisualStudio.Component.LiveUnitTesting,version=15.0.26206.0)
        Managed Desktop Workload Core (Microsoft.VisualStudio.Component.ManagedDesktop.Core,version=15.0.26109.1)
        Modeling SDK (Microsoft.VisualStudio.Component.DslTools,version=15.0.26109.1)
        Node.js support (Microsoft.VisualStudio.Component.Node.Tools,version=15.0.26206.0)
        NuGet package manager (Microsoft.VisualStudio.Component.NuGet,version=15.0.26004.1)
        Profiling tools (Microsoft.VisualStudio.Component.DiagnosticTools,version=15.0.26109.1)
        SQL Server Data Tools (Microsoft.VisualStudio.Component.SQL.SSDT,version=15.0.26206.0)
        Text Template Transformation (Microsoft.VisualStudio.Component.TextTemplating,version=15.0.26004.1)
        Visual Studio core editor (Microsoft.VisualStudio.Component.CoreEditor,version=15.0.26004.1)
        Visual Studio SDK (Microsoft.VisualStudio.Component.VSSDK,version=15.0.26206.0)
        Web Deploy (Microsoft.VisualStudio.Component.WebDeploy,version=15.0.26004.1)
        WebSocket4Net (Component.WebSocket,version=15.0.26109.1)
        Windows Communication Foundation (Microsoft.VisualStudio.Component.Wcf.Tooling,version=15.0.26109.1)
    Log
        D:\Users\6587\AppData\Local\Temp\dd_setup_20170215092106_005_Microsoft.VisualStudio.MinShell.Msi.log
    Details
        MSI: C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualStudio.MinShell.Msi,version=15.0.26206.0\Microsoft.VisualStudio.MinShell.Msi.msi, Properties:  REBOOT=ReallySuppress ARPSYSTEMCOMPONENT=1  MSIFASTINSTALL="7"  VSEXTUI="1"  VS7.3643236F_FC70_11D3_A536_0090278A1BB8="E:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise" 
        Return code: 1714
        Return code details: The older version of vs_minshellmsi cannot be removed.  Contact your technical support group.

此消息抱怨某个包 vs_minshellmsi 由于 C:\Windows\Installer 中缺少另一个包而没有被删除.现在,我已经尝试了很多在互联网上提到的事情,但我没有任何运气:

This message is complaining about a certain package vs_minshellmsi not getting removed due to another package missing in C:\Windows\Installer. Now, I have tried numerous thing mentioned over the internet but I'm not having any luck:

  • 试图从运行完美的第二台 PC 中找到丢失的文件.那里没有这样的文件
  • 完全删除了 VS2017 安装程序
  • 运行 VS2017 安装程序只是为了安装 VS20217 安装程序,以便我可以运行 InstallCleanup.exe -full
  • 为 VS2017 创建了一个完整的离线安装点 (--layout) 并寻找有问题的包

以上都不适合我.现在,我找到了一个 PS 脚本来删除 VS2017 preview-4 并尝试使用它来解决我的情况,但仍然没有操作:https://gist.github.com/timsneath/9f9e384ef7b986fbcd873e75e4cae7c4

None of the above worked for me. Right now, I found a PS script to remove VS2017 preview-4 and trying to use that to resolve my situation but still no-op: https://gist.github.com/timsneath/9f9e384ef7b986fbcd873e75e4cae7c4

脚本如下:

# Setup assets
$foldersToDelete = ,"$env:ProgramData\Microsoft\VisualStudio\Packages"
$foldersToDelete += "$env:AppData\Microsoft\VisualStudio\Packages"
$foldersToDelete |? { Test-Path $_ } |% { del -rec -for $_ }

# VS assets
#   Any VS installation folders
if (test-path $env:ProgramData\Microsoft\VisualStudio\Packages\_Instances) {
    gci $env:ProgramData\Microsoft\VisualStudio\Packages\_Instances -filter state.json -recurse | gc -raw | convertfrom-json | select -expand installationPath | del -force -recurse
}

if (test-path "${env:ProgramFiles(x86)}\Microsoft Visual Studio") {
    del -rec -for "${env:ProgramFiles(x86)}\Microsoft Visual Studio"
}

del -rec -for $env:localappdata\Microsoft\VisualStudio\15.0*,$env:AppData\Microsoft\VisualStudio\15.0*

reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\ | findstr 15.0 |% { reg delete $_ /f }
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft | findstr VisualStudio_ |% { reg delete $_ /f }
Reg query HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio | findstr 15.0 |% { reg delete $_ /f }

# Remove all VS singletons
# get-package vs_* | uninstall-package
get-package -provider msi | where { $_.name -like "vs_*" } | uninstall-package -additionalArguments "IGNOREDEPENDENCIES=ALL"

我运行了这个脚本,它执行时没有错误和输出.最后一行是我感兴趣的:

I ran this script and it executed with no errors and output. The last line is what I'm interested in:

PS C:\Windows\system32> get-package -provider msi | where { $_.name -like "vs_*" }

Name                           Version          Source                           ProviderName
----                           -------          ------                           ------------
vs_codecoveragemsi             15.0.26004                                        msi
vs_professionalmsi             15.0.26004                                        msi
vs_BlendMsi                    15.0.26004                                        msi
vs_update3notification         14.0.25431                                        msi
vs_devenvmsi                   15.0.26004                                        msi
vs_filehandler_x86             15.0.26004                                        msi
vs_cuitextensionmsi            15.0.26004                                        msi
vs_minshellinteropmsi          15.0.26004                                        msi
vs_SQLClickOnceBootstrappermsi 15.0.26004                                        msi
vs_tipsmsi                     15.0.26004                                        msi
vs_communitymsires             15.0.26004                                        msi
vs_networkemulationmsi_x64     15.0.26004                                        msi
vs_cuitcommoncoremsi           15.0.26004                                        msi
vs_clickoncebootstrappermsi    15.0.26004                                        msi
vs_minshellmsires              15.0.26004                                        msi
vs_cuitextensionmsi_x64        15.0.26004                                        msi
vs_communitymsi                15.0.26004                                        msi
vs_enterprisemsi               15.0.26004                                        msi
vs_minshellmsi                 15.0.26004                                        msi
vs_clickoncebootstrappermsires 15.0.26004                                        msi
vs_codeduitestframeworkmsi     15.0.26004                                        msi
vs_clickoncesigntoolmsi        15.0.26004                                        msi
vs_filehandler_amd64           15.0.26004                                        msi

我无法摆脱这些包裹.当我运行最后一行时,什么也没有发生,我仍然可以过滤这些特定的包.

I cannot get rid of these packages. When I run the last line, nothing happens and I'm still able to filter these particular packages.

编辑

现在还剩下一些我没有来源且无法卸载的软件包.我需要一种方法来强制删除这些(用 * 标记)

There are now a few packages left that I don't have sources of and cannot uninstall. I need a way to force remove these (marked with a *)

Name                           Version   

vs_networkemulationmsi_x64     15.0.26208
vs_SQLClickOnceBootstrappermsi 15.0.26208
vs_communitymsires             15.0.26228
vs_webtestrecordermsi_x64      15.0.26208
vs_minshellmsi                 15.0.26228
vs_filehandler_amd64           15.0.26228
vs_loadtestexceladdinmsi       15.0.26208
vs_Graphics_Singletonx64       15.0.26208
vs_BlendMsi                    15.0.26004*
vs_update3notification         14.0.25431
vs_cuitcommoncoremsi           15.0.26208
vs_clickoncebootstrappermsires 15.0.26208
vs_minshellmsires              15.0.26228
vs_communitymsi                15.0.26228
vs_codecoveragemsi             15.0.26208
vs_filehandler_x86             15.0.26228
vs_professionalmsi             15.0.26228
vs_cuitextensionmsi            15.0.26208
vs_FileTracker_Singleton       15.0.26208
vs_devenvmsi                   15.0.26208
vs_tipsmsi                     15.0.26208
vs_helpconfigmsi               15.0.26208
vs_clickoncebootstrappermsi    15.0.26208
vs_cuitextensionmsi_x64        15.0.26004*
vs_minshellinteropmsi          15.0.26208
vs_Graphics_Singletonx86       15.0.26208
vs_webtestrecordermsi          15.0.26208
vs_feedbackclientmsi           15.0.26208
vs_enterprisemsi               15.0.26228
vs_codeduitestframeworkmsi     15.0.26004*
vs_clickoncesigntoolmsi        15.0.26208
vs_labtestagentdeployermsi     15.0.26208

我的 Windows 在安装过程中崩溃后遇到了同样的问题,我在谷歌上搜索了很多,我发现微软提供了一个完全删除 MSI 包的工具.

I had same issue after my Windows crashed middle of setup i searched google a lot and i found a tool from microsoft that remove MSI package completely.

Program_Install_and_Uninstall 来自 页面

在我的情况下,vs"安装程序每次从日志中显示不同的名称"时都会显示相同的错误.我只是将它们一一删除,问题解决了.

in my case "vs" installer shows me same error each time different "Name" from log. I just removed them one by one and problem solved.