解决“A problem has been encountered while loading the setup components. Canceling setup.”的问题

近来因为需要开发C++的程序,所以要在Visual Studio 2008中添加C++的开发组件,但是在添加组件的时候,弹出“A problem has been encountered while loading the setup components. Canceling setup.”的提示。无奈之下,只好卸载,但卸载的时提示依旧,郁闷。

 

上百度查了一把,找到一条解决方案:Visual Studio 2008无法重装的解决办法之一。其中提到了Windows install clean up,好吧,去下这个工具来。运行起来后找到Visual Studio 2008相关的项,选中后点击“Remove”按钮,hoho,出了一大堆命令行窗口在运行。完事后再来重装Visual Studio 2008,就搞定啦。

当安装 VS 2008 SP1 之后,如果想再运行原始 VS2008 安装程序进行修复、更改将遭遇如下错误:

"A problem has been encountered while loading the setup components. Canceling setup."

这是因为 SP1 安装之后,更新了 VS 某些相关产品的信息,如产品号、产品版本号等等,这些更新写入了安装目录,导致原始 setup.exe 无法执行检测逻辑而失败。

此时需要从 控制面板 》 添加/删除程序 》 找到对应的 VS 版本 》 点击卸载/更改 启动安装向导。

参考:http://blogs.msdn.com/heaths/archive/2008/08/20/do-not-repair-vs-2008-sp1-from-installation-media.aspx

If you need to repair Visual Studio 2008 once SP1 has been applied or wish to change which features are installed, you cannot run setup.exe from the original installation media.

When you run repair from media you may see an error like, "A problem has been encountered while loading the setup components. Canceling setup."

Workaround

Open the Control Panel and go to Add/Remove Programs, or on Vista click on the "Uninstall a program" link under Programs. Find Microsoft Visual Studio 2008 (the exact product name will vary based on edition and language installed) and click on the Uninstall/Change button. When setup launches and components are loaded, you will be asked to repair, change features, or uninstall. Choose the option you which to perform and continue as directed.

Details

Visual Studio is actually a collection of different installation packages, just as VS2008 SP1 is a collection of different installation packages. VS2008 SP1 replaces some of the original packages using minor or major upgrades and patches other products. This changes information about the products originally installed like the ProductCode and/or ProductVersion. This affects the detection logic that setup.exe uses to determine what to do when installing, repairing, or uninstalling the product.

This information is stored both on the installation media as well as on your hard disk under the target installation directory. For various reasons including that media is often write-protected, we can only update this information stored on your hard disk. So once SP1 is installed, the detection and package information on the installation media and on your hard disk are out of sync and only the copy on your hard disk contains the correct information. 

原文地址:https://www.cnblogs.com/avril/p/1740495.html