简体   繁体   English

如何防止vc_redist.x ##。exe(VS2017)因挂起的重启而模棱两可地失败?

[英]How to prevent vc_redist.x##.exe (VS2017) from ambiguously failing due to pending reboot?

TL;DR What is the sane way to automate invokation of VS 2017 vc_redist when called in a chain of several installers? TL; DR在多个安装程序链中调用时,自动调用VS 2017 vc_redist的明智方法是什么?


The Visual C++ Redistributable Installer that MS provides for VS 15.x (VS 2017), namely both (14.15.26706 - VS 15.8.4)): 视觉C ++再分发安装该MS提供用于VS的15.x(VS 2017),即两个 (14.15.26706 - VS 15.8.4)):

  • vc_redist.x86.exe
  • vc_redist.x64.exe

As part of our full product installation, I have to run several vcredist installers (also older versions) silently. 作为完整产品安装的一部分,我必须静默运行多个 vcredist安装程序(也是旧版本)。

The problem now is that these installers will refuse to install if a reboot is pending (eg "HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager" - PendingFileRenameOperations ). 现在的问题是, 如果挂起重新启动 ,这些安装程序将拒绝安装 (例如"HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager" - PendingFileRenameOperations )。

When calling these installers with vc_redist /q , they will even trigger an immediate system reboot. 当使用vc_redist /q调用这些安装程序时,它们甚至会触发立即重启系统。 This can be fixed by calling them with /q /norestart , however: 可以通过/q /norestart ,但是:

When calling vc_redist /q /norestart , and if a reboot is pending prior to this installer, it will return MSI exit code 3010 which indicates that a reboot is required. 当调用vc_redist /q /norestart ,如果此安装程序之前未进行重新引导,它将返回MSI退出代码3010 ,指示需要重新引导。

However , AFAIK, this exit code also indicates, that this very setup requires a reboot to complete. 但是 ,AFIAK,此退出代码表明,此安装程序需要重新启动才能完成。

Actual question 实际问题

So, I cannot distinguish whether this installer was succesful and just requires a reboot at the very end of my installation sequence (I do install otehr stuff before and after) - or whether the installer actually refused to do anything and I would need to restart the system and start this installer again! 因此,我无法区分此安装程序是否成功,是否仅需要在安装顺序的最后一次重新启动(我在安装前后都安装了其他东西), 或者安装程序是否实际上拒绝执行任何操作,而我需要重新启动系统,然后再次启动此安装程序!

How can I call this vc_redist in a chain of different third party installers and 如何在不同的第三方安装程序链中将该vc_redist称为

  • ideally require just one reboot at the very end 理想情况下,最后只需要一次重启
  • at the very least, determine whether it installed successfully. 至少要确定它是否安装成功。

Some additional infos, fwiw: 一些其他信息,如下:

Not sure these helkp with the question, but for completeness sake. 不确定这些问题,但出于完整性考虑。

  • The installer GUI clearly indicates what is going on: (sorry, german Windows) 安装程序GUI清楚地指示正在发生的事情:(对不起,德语Windows)

弹出框

"No action was taken because a reboot of the system is required." “未采取任何行动,因为需要重新启动系统。”

摘要/关闭/重新启动

  • This is an InnoSetup built installer for our "product suite", that will be used by customers, the installation order goes as follows: 这是我们的“产品套件”的InnoSetup内置安装程序,将由客户使用,安装顺序如下:

    1. Run MSVC 2005 (VC8) 32 bit vcredist 运行MSVC 2005(VC8)32位vcredist
    2. Run MSVC 2010 (VC10) 32 bit vcredist 运行MSVC 2010(VC10)32位vcredist
    3. Run MSVC 2017 (VC141) 64 bit vcredist 运行MSVC 2017(VC141)64位vcredist
    4. Run MSVC 2017 (VC141) 32 bit vcredist 运行MSVC 2017(VC141)32位vcredist
    5. Run a few other third party dependecy / library installers 运行其他一些第三方依赖性/库安装程序
    6. Install the actual application files (via InnoSetup) 安装实际的应用程序文件(通过InnoSetup)
    7. Reboot (ask) if any installer indicated a required reboot. 如果有任何安装程序指示需要重新启动,请重新启动(询问)。

As you can see from this sequence, rebooting after each vcredist woud be insane, and luckily it seems only the 2017 redist exhibits this unfortunate behaviour so far. 从该序列中可以看到,每个vcredist都将疯狂后重新启动,幸运的是,到目前为止,似乎只有2017年的redist表现出这种不幸的行为。

Of note : My trial runs on my dev machine all started with a reboot already pending at "step 0", and both the VC2005 and VC2010 installer run just fine (as verified through their GUI progress) even if a reboot is pending before hand. 值得注意 :我的试用我的开发机上运行的一切都始于一个重启已在“步0”等待,并且两个VC2005和VC2010安装程序运行得很好(通过其GUI进度验证)即使重启手审理。 It's the VC2017 installers that refuse to do anything if a reboot is pending. 如果挂起重启,则VC2017安装程序将拒绝执行任何操作。

MSU Packages : After decompiling the vc_redist.x64.exe - which is a WiX bundle - using this command: MSU软件包 :使用以下命令反编译vc_redist.x64.exe (它是WiX捆绑包)后:

dark.exe -x Extract vc_redist.x64.exe

I found that the bundle installs: Update for Universal C Runtime in Windows - KB2999226 . 我发现捆绑软件​​已安装: Windows KB2999226中的Universal C Runtime更新 This component consists of Windows Update files ( *.msu - used by Windows Update) and not just MSI files. 该组件由Windows Update文件*.msu -Windows Update使用)组成,而不仅仅是MSI文件。 I would suspect that they could be designed to require a reboot before allowing installation, but I don't have proof . 我怀疑它们可能被设计为在允许安装之前需要重新启动,但我没有证据

Suggestion : Run a check to make sure KB2999226 is installed. 建议 :运行检查以确保已安装KB2999226 How to do this? 这个怎么做? I don't know a Win32 call, but the WiX guys will probably know. 我不知道Win32电话,但是WiX家伙可能会知道。 Here are some other suggestions . 这里还有其他一些建议


The actual Windows Update Files are (over time these file names could change as new versions of this installer with the versionless file name - vc_redist.x64.exe - are released): 实际的Windows更新文件是(随着时间的推移,这些文件名可能会随着具有无版本文件名vc_redist.x64.exe的该安装程序的新版本的发布而更改):

  • Windows6.0-KB2999226-x64.msu
  • Windows6.1-KB2999226-x64.msu
  • Windows8.1-KB2999226-x64.msu
  • Windows8-RT-KB2999226-x64.msu

In other words for Vista, Windows 7, Windows 8 et al. 换句话说,对于Vista,Windows 7,Windows 8等。 Various Server OS's as well. 各种服务器操作系统也是如此。 Windows 10 has this component built-in. Windows 10内置了此组件。

Corporate Deployment : In a corporate environment I would deploy these *.msu files via the distribution mechanism available - whatever it might be - for example SCCM - before installing the vc_redist.x64.exe package. 公司部署 :在公司环境中,在安装vc_redist.x64.exe程序包之前,我将通过可用的分发机制(无论可能是什么)(例如SCCM)来部署这些*.msu文件。

This should yield better control of the distribution process as you get error messages straight from the MSUs themselves. 当您直接从MSU本身获取错误消息时,这应该可以更好地控制分发过程。

Frankly these are core-SOE components in my opinion. 坦率地说,这些是SOE的核心组成部分。 I don't know why Microsoft keep these runtimes out of the main OS installation. 我不知道为什么Microsoft将这些运行时保留在主要的OS安装之外。 They are crucial for most software. 它们对于大多数软件至关重要。


A description of the decompilation approach using the WiX toolkit's dark.exe binary can be found here: How can I compare the content of two (or more) MSI files? 可以在以下位置找到使用WiX工具包的dark.exe二进制文件进行反编译方法的说明: 如何比较两个(或多个)MSI文件的内容?

Strictly speaking, error 3010 is a success result. 严格来说,错误3010是成功的结果。 It means that the install has completed but requires a reboot. 这意味着安装已完成,但需要重新启动。 I'm not aware of anything to indicate that it means the install didn't start at all. 我不知道有什么迹象表明安装根本没有开始。 The typical "won't install if reboot pending" is a result of using a launch condition based on the MsiSystemRebootPending property. 典型的“如果挂起重新启动将不会安装”是基于MsiSystemRebootPending属性使用启动条件的结果。 Failures due to this launch condition do not return return a 3010 result - they usually return a 1602 error as a kind of "user cancel" error. 由于此启动条件而导致的失败不会返回3010结果-它们通常会返回1602错误,这是一种“用户取消”错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM