强制重新启动的自定义操作微星在C# [英] Force Reboot from Custom Action in Msi in C#

查看:234
本文介绍了强制重新启动的自定义操作微星在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何能够提示重新启动计算机,从C#自定义操作在安装后?

How can we prompt for a computer restart after install from within a C# custom action?

我们正在使用VS 2005的安装项目为我们的设置,我们需要。编程决定提示重新启动(所以它不会发生在每一个安装,只是在某些)

We are using VS 2005's setup project for our setup, and we need to programmatically decide to prompt for a restart (so it will not happen on every install, just on some).

更新:我们正在寻找一个已经建成的东西微星自定义动作系统第一。如果不存在,我们可以诉诸某种方式重新启动计算机后自己,而是想避免

UPDATE: We're looking for something that is already built into the MSI custom action system first. If that doesn't exist, we can resort to restarting the PC ourselves somehow, but would like to avoid that.

更新:我们看到在这里你可以设置重新启动=力编辑在奥卡微星的时候,你可以修改在运行时从一个C#自定义操作这些表?我们可以将其设置为重新启动每一次,但可能让我们的设置烦人(它将只需要重新启动在少数情况下)

UPDATE: We see where you can set REBOOT=Force when edited the Msi in Orca, can you modify these tables from a C# custom action at runtime? We could set this to restart every time, but that might make our setup annoying (it will only need to restart on rare occasions).

更新:我们尝试设置:

savedState["REBOOT"] = "Force";



从我们的自定义操作的安装()方法中,但没有运气。它似乎并不像IDictionary的,savedState确实什么

From within the Install() method of our custom action, but no luck. It doesn't seem like the IDictionary, savedState really does anything.

也试过:

Context.Parameters["REBOOT"] = "Force";



但我认为这个集合只是传递到自定义操作命令行参数。

But I think this collection is just the command line arguments passed to the custom action.

更新:有没有我们的编辑与MSI逆戟鲸,使这一招工作的方法吗?也许安排上的某些文件现有的条件重新启动?我们还没有找到如何设置从C#自定义操作MSI属性。

UPDATE: Is there a way to edit our MSI with Orca to make this trick work? Maybe schedule a reboot on a condition of some file existing? We have not found how to set MSI properties from a C# custom action.

更新:我们试图钩住AppDomain.ProcessExit和AppDomain.DomainUnload并启动一个新的线程并调用Process.GetCurrentProcess()。WaitForExit(),没有这些事件将触发从C#自定义操作中...

UPDATE: We tried hooking into AppDomain.ProcessExit and AppDomain.DomainUnload and starting a new thread and calling Process.GetCurrentProcess().WaitForExit() and none of those events will fire from within a C# custom action...

推荐答案

因为它似乎,为我们解决这个问题的唯一办法就是之一:

As it seems, the only way for us to solve this is to either:

A)修改MSI与逆戟鲸制作安装重启每安装

A) Modify the MSI with orca to make the setup restart for every install

b)重做安装项目与维克斯或安装屏蔽

B) Redo the setup project with WiX or Install Shield

感谢您的帮助球员。

这篇关于强制重新启动的自定义操作微星在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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