WIX 检测待重启 [英] WIX Detect Pending Reboot

查看:26
本文介绍了WIX 检测待重启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 WiX 的自定义 BA,我想检测是否有挂起的重启以在我的用户尝试安装之前警告他们,结果却失败了.如何在 Burn 中引用 Reboot Pending 属性(WiX)这个问题只告诉我什么不起作用,OP 标记了一个答案,所以没有人回答他的后续问题,已经被告知 Burn 中的 RebootPending 属性可能与 Windows Installer 使用的属性不完全对应,如何否则我会确保我的应用程序在等待重启时不会尝试安装吗?"这就是我想知道的.

I'm using a custom BA with WiX and I'd like to detect if there is a pending reboot to warn my user before they try to install, only to have it fail. How do I reference the Reboot Pending Property in Burn (WiX) That question only showed me what doesn't work, and the OP marked an answer so no one has answered his followup question of, "Having been informed that the RebootPending property inside Burn may not correspond exactly to the property that Windows Installer uses, how else would I ensure that my application does not attempt to install when a reboot is pending?" That is what I'd like to know.

推荐答案

由于我使用的是托管安装程序引导程序应用程序,因此我最终在 C# 中使用:

Since I'm using a managed installer bootstrapper application I ended up doing this in C# using:

string regLoc = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager";
string[] regKey = (string[])Registry.GetValue(regLoc, "PendingFileRenameOperations", new string[]{"DefaultValue"});

该密钥中的条目是等待重新启动以便可以更改的文件.虽然这不是万无一失的,但它提供了一个可能的指示,表明安装可能会因挂起的重启而失败.

Entries in that key are files waiting for a reboot so they can be changed. Although this isn't bulletproof, it gives a likely indicator that the install might fail because of a pending reboot.

这篇关于WIX 检测待重启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆