[英]How can I prompt the user to reboot in a .NET installation?
I'm using Visual Studio 2008 to write an installation, and I'm a completely new to installations. 我正在使用Visual Studio 2008编写安装,并且对安装是全新的。 I've created an installation and successfully written some custom actions using a C# assembly.
我创建了一个安装程序,并使用C#程序集成功编写了一些自定义操作。 One action sets a RunOnce registry value, and now I need to prompt the user to reboot when the installation finishes, but I have no idea how.
一个操作设置了RunOnce注册表值,现在我需要在安装完成时提示用户重新启动,但我不知道如何。 I've read the Installer class documentation, but I can't find any mention of rebooting.
我已经阅读了Installer类的文档,但是找不到任何有关重启的信息。
I'm assuming I need to somehow get down to being able to call MsiSetProperty and set a REBOOT property, but I don't know how to do that from my .NET installer project. 我假设我需要以某种方式开始能够调用MsiSetProperty并设置REBOOT属性,但是我不知道如何从.NET安装程序项目中执行此操作。
Thanks. 谢谢。 I ended up using a post-build event to run a batch file with the following command.
我最终使用构建后事件通过以下命令运行批处理文件。 The hard part was tracking down WiRunSQL.vbs, which was in the "Windows SDK Components for Windows Installer Developers" download.
困难的部分是跟踪WiRunSQL.vbs,该文件位于“用于Windows Installer开发人员的Windows SDK组件”下载中。
cscript "C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\SysMgmt\MSI\scripts\WiRunSQl.vbs" my.msi "INSERT INTO `Property`(`Property`, `Value`) VALUES ('REBOOT', 'F')"
If you are implementing your installer using WiX , you need to add this: 如果要使用WiX实施安装程序,则需要添加以下内容:
<ScheduleReboot After="InstallFinalize"/>
If you're using the cut-down "Installer" project in Visual Studio , I'm not sure... But this link here suggests a CScript command that seems to show how to inject an MSI property into the installer project, much as you want to do. 如果您使用切下“安装”项目在Visual Studio中 ,我不知道......但是这个链接在这里提出一个的CScript ,似乎显示了如何将MSI属性注入到安装项目的命令,就像你想做。
Just set the property in the MSI initally, rather than trying to update it at runtime. 只需在MSI中初始设置属性,而不是尝试在运行时进行更新。
Visual Studio 2008 ships with WiX anyway, see Visual Studio ships the WiX toolset for more details. 无论如何,Visual Studio 2008都随WiX一起提供,有关更多详细信息,请参见Visual Studio随WiX工具集提供。 That said, I'm not a Visual Studio 2008 user, so I don't know if that's in addition, or in replacement to the previous Visual Studio setup projects.
就是说,我不是Visual Studio 2008用户,所以我不知道这是在添加还是替代以前的Visual Studio安装项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.