gpt4 book ai didi

WiX - 试图找出安装顺序

转载 作者:行者123 更新时间:2023-12-04 16:21:02 26 4
gpt4 key购买 nike

我正在安装一个大型应用程序,其中一部分是一个名为“DbUpdateManager”的自定义编写工具,用于针对我们的目标数据库批量执行 SQL 脚本。

现在,WiX 2.x 安装工作正常——但它有一个缺陷:在安装过程中,我还安装了几个 Windows 服务,可以选择立即启动。但是,如果 DbUpdateManager 尚未运行,这些将失败。

所以我想要完成的是:

  • 从我的 MSI
  • 安装 DbUpdateManager 和我的服务
  • 在任何服务启动之前运行 DbUpdateManager

  • 我当前的 WiX 源看起来像这样:
    <Directory Id='INSTALLDIR' Name='DbUpdMgr' LongName='DbUpdateManager' >
    <!-- DbUpdateManager component with the necessary files -->
    <Component Id='DbUpdateManagerComponent' Guid='...' DiskId='1'>
    <File Id='DbUpdateManagerFile' LongName='DbUpdateManager.Wizard.exe'
    Name='DbUmWz.exe' src='DbUpdateManager.Wizard.exe' KeyPath='no' />
    </Component>

    <!-- Component to install one of my Windows services -->
    <Component Id='InstallServiceComponent' Guid='...' DiskId='1'>
    <File Id='InstallServiceFile' LongName='MyService.exe'
    Name='MyServic.exe' src='MyService.exe' KeyPath='yes'/>
    <ServiceInstall Id='InstallMyService' Name='MyService'
    Description='My Service' ErrorControl='normal'
    Start='auto' Type='ownProcess' Vital='yes' />
    <ServiceControl Id='UninstallMyService' Name='MyService'
    Remove='uninstall' Wait='yes' />
    </Component>

    <!-- Feature for the DbUpdateManager referencing the above component -->
    <Feature Id='DbUpdateManager' ConfigurableDirectory='INSTALLDIR'
    AllowAdvertise='no' Description='DbUpdateManager' Level='1'
    Title='Database Update Manager'>
    <ComponentRef Id='DbUpdateManagerComponent'/>
    </Feature>

    <!-- Custom action for running DbUpdateManager -->
    <CustomAction Id='RunDbUpdateManagerAction' FileKey='DbUpdateManagerFile'
    ExeCommand='' Return='asyncWait' />

    <!-- Calling the custom action in the install sequence -->
    <InstallExecuteSequence>
    <RemoveExistingProducts After='InstallInitialize' />
    <Custom Action='RunDbUpdateManagerAction'
    After='InstallFinalize'>&amp;DbUpdateManager=3</Custom>

    我继承了这个 WIX,它可以工作 - 但正如我所说 - DbUpdateManager 在过程中被调用太晚(只有“After=InstallFinalize”),因此服务一开始将无法正常启动(第二次运行正常)在 DbUpdateManager 运行后手动重新启动它们时)。

    我稍微浏览了 MSI 文档,发现了一个名为“StartServices”的好步骤,所以我的直觉是将调用自定义操作更改为:
       <InstallExecuteSequence>
    <Custom Action='RunDbUpdateManagerAction'
    Before='StartServices'>&amp;DbUpdateManager=3</Custom>

    不幸的是,在这种情况下,什么也没有发生 - DbUpdateManager 永远不会被调用......

    任何想法为什么?调试 MSI/WiX 的东西真的很棘手,我似乎再也看不到树木的森林......

    谢谢!
    马克

    编辑:“RunDbUpdateManagerAction”被放置在我的 MSI 的 InstallExecuteSequence 表中的正确位置 - 就在 InstallServices 之后,就在 StartServices 之前 - 但它不起作用...... DbUpdateManager(一个 Winforms 实用程序)在安装 :-(

    编辑 2:现在我的操作似乎在正确的时间执行了 - 不幸的是,我只是没有看到我的向导 :-( 我看到的是错误代码“返回值 1631”,意思是“MSI 服务”无法启动”-wtf ???

    MSI (s) (2C:D8) [20:53:36:383]:执行操作:RunDbUpdateManagerAction
    操作 20:53:36:RunDbUpdateManagerAction。
    操作于 20:53:36 开始:RunDbUpdateManagerAction。
    MSI (s) (2C:D8) [20:53:36:383]:执行操作:StartServices
    行动 20:53:36:StartServices。服务正在启动
    行动开始于 20:53:36:StartServices。
    操作在 20:53:36 完成:RunDbUpdateManagerAction。返回值 1631。

    最佳答案

    嗯,我终于让它工作了 - 在每个回复的人的帮助下,并通过查阅一些 WiX 教程和网络上的帮助页面。 MSI安装程序的东西不容易弄清楚和学习......

    基本上,我将自定义操作的执行更改为“延迟”(如 Rob 所建议的),并将执行顺序中的点移动到“After=InstallFiles”。我还将 标记中的条件更改为“未安装”,这在我的场景中似乎工作得很好。

    与 Rob 担心的相反,Db 更新管理器及其 UI 以这种方式出现得非常好,并且在我们的任何服务(依赖于数据库)开始之前,更新我们的数据库的过程现在已经完成。

    期待 WiX 3.0(及其 future )的完整 RTM 版本!

    感谢大家——不幸的是,我只能接受一个答案——所有人都应得的。

    马克

    关于WiX - 试图找出安装顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/778210/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com