需要 WIX Bootstrapper 在 .NET Framework 安装后重新启动并跳过应用程序启动 [英] Require WIX Bootstrapper to reboot after .NET Framework installation and skip application launch

查看:32
本文介绍了需要 WIX Bootstrapper 在 .NET Framework 安装后重新启动并跳过应用程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢安德烈在这里的回答:

Thanks to Andrei's answer here:

使用 WIX 安装程序安装 .NET Framework 4.7.2(如果需要)

我检查是否安装了 .NETFramework 4.7.2 并安装它.不过我还有一个小问题……我的主应用程序有一个安装后操作来启动该应用程序.在安装 4.7.2 并且系统重新启动之前,无法启动该应用程序.我可以简单地从我的应用程序安装程序中删除此安装后操作代码,但是如果 4.7.2 已经安装并且没有理由重新启动,它会启动应用程序会很好.

I check to see if .NETFramework 4.7.2 is installed and install it. I have one slight problem remaining though... My main app has a post install action that launches the app. One can't launch the app until 4.7.2 has been installed AND the system has been rebooted. I could simply remove this post install action code from my apps installer, but it would be nice if it did launch the app if 4.7.2 was already installed and there is no reason to reboot.

如何从我的应用程序安装程序查看"我的 Bootstrapper 项目并查看 .NET Framework 是否刚刚安装?然后我可以有条件地运行安装后操作.如果刚刚安装了4.7.2,我相信它会提示要求重新启动,这是完美的.

How can I "see" into my Bootstrapper project from my apps installer and see if .NET Framework was just installed or not? I could then conditionally run the post install action. If 4.7.2 was just installed, I believe it will put up a prompt asking for a reboot which is perfect.

欢迎提出有关处理问题的其他方法的建议.我想另一种处理事情的方法是在 .NET 安装后强制重启,并在重启后安装我的应用程序.但我认为最好安装所有内容然后重新启动.我认为这是一个非常普遍的问题,但我还没有找到任何解决它的方法.或许问题太简单了吧!我是 WIX 的新手,不清楚如何将变量和信息从一个项目共享到另一个项目.特别是从主应用程序安装程序获取引导程序信息.如果我能提供说明或更多细节,请告诉我.
谢谢!

Suggestions on other ways to handle the problem are welcome. I suppose another way to handle things would be to force a reboot after the .NET installation and after the reboot install my app. But I think it would be better to install everything and then reboot. I would think this is a very common problem but I haven't found anything addressing it. Perhaps it's too easy a problem! I'm new to WIX and not clear how to share variables and information from one project to another. Especially getting bootstrapper info from the main app installer. Let me know if I can provide clarification or more details.
Thanks!

安装后操作如下所示:

<CustomAction Id="PostInstallAction"
      Return="check"
      Execute="immediate"
      BinaryKey="MyAppInstaller.CustomActions.CA.dll"
      DllEntry="PostInstallAction" />

    <InstallExecuteSequence>
      <Custom Action="PreInstallAction" Before="InstallValidate"  />
      <Custom Action="PostInstallAction" After="InstallFinalize"  />
    </InstallExecuteSequence>

// follow function abbreviated (no logging and try/catch).In file customactions.cs
public static ActionResult PostInstallAction(Session session)
        {                             
                if (!Process.GetProcessesByName(MyAppLauncherFileName).Any())
                    Process.Start(ConfigurationManager.AppSettings[MyAppLauncherExePath]);

                return ActionResult.Success;              
        }

跟进:如果安装 4.7.2 所需的重启是自动发生的,而不是提示用户,那也很好.有没有办法做到这一点,或者是硬编码到 4.7.2 中.网络安装程序?

FOLLOW UP: It would also be nice if the reboot which is required to install 4.7.2, happened automatically, rather than prompting the user. Is there a way to do that, or is that hard coded into the 4.7.2. web installer?

推荐答案

关于检查是否安装了 .NET 4.6.1 或更高版本,您可以添加:

Regarding checking if .NET 4.6.1 or higher is installed or not you can add this:

<PropertyRef Id="WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED" />
  <Condition Message="$(var.ProductName) requires .NET Framework 4.6.1 or 
higher.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_461_OR_LATER_INSTALLED]]>
</Condition>

关于重启,您可以使用 ForceReboot 操作中的 Supress 属性.你可以参考下一个网址:

Regarding the reboot, you can use the Supress property from ForceReboot action. You can consult the next urls for that:

http://wixtoolset.org/documentation/manual/v3/xsd/wix/forcereboot.html

https://docs.microsoft.com/en-us/windows/desktop/MSI/reboot

https://docs.microsoft.com/en-us/windows/desktop/Msi/forcereboot-action

这篇关于需要 WIX Bootstrapper 在 .NET Framework 安装后重新启动并跳过应用程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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