在WIX安装开始时部署并运行应用程序

时间:2010-05-18 01:15:10

标签: installer wix launch

我正在尝试使用WIX在MSI安装开始时部署并运行一个应用程序(C#控制台应用程序)但是有一些困难。

应用程序需要在任何Web服务器操作发生之前运行,但在将文件从MSI复制到目标位置之后运行。

我可以让应用程序运行,但前提是我在运行MSI之前实际上已将应用程序复制到目录中。如果我不这样做,我会收到与MSI日志中不存在的应用程序相关的错误。所以基本上我认为它与我正在使用的启动序列有关,我需要确保应用程序在运行之前存在。

想知道你们中的一个好人可以帮助我。

要求是应用程序必须作为WIX MSI的第一件事运行(实际上在任何Web服务部分发生之前)。

Wix的相关位如下:

    <CustomAction Id='LaunchUpdaterRunFirst' FileKey='serverUpdaterRunFirstExe' ExeCommand='' Return='ignore' />

...

    <InstallExecuteSequence>
       <Custom Action='CA_BlockOlderVersionInstall' After='FindRelatedProducts'>NEWERVERSIONDETECTED</Custom>
       <RemoveExistingProducts After="InstallInitialize" />
       <Custom Action='LaunchUpdaterRunFirst' After='InstallInitialize' />
       <Custom Action='LaunchInstaller' After='InstallFinalize'><![CDATA[ REMOVE <> "ALL" and  UILevel <> 2]]></Custom>
    </InstallExecuteSequence>

...

     <Component Id="ServerInstaller" DiskId="1" Guid="9662EC72-1774-4d22-9F41-AD98A5DCD729">
        <File Id="serverUpdaterRunFirstExe" Name="MyCompany.Server.Updater.RunFirst.exe" Source="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe" />
        <File Id="serverUpdaterRunFirstExeConfig" Name="MyCompany.Server.Updater.RunFirst.exe.config" Source="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe.config" />

非常感谢任何帮助或参考。

2 个答案:

答案 0 :(得分:-1)

不是将可执行文件添加到要安装的文件列表中,而是将其作为二进制文件输入,即

<Product ......>

  <Binary Id="serverUpdaterRunFirstExe" SourceFile="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe" />

  <CustomAction Id="LaunchUpdaterRunFirst" BinaryKey="serverUpdaterRunFirstExe" />

</Product>

答案 1 :(得分:-2)

请参阅WiX InstallExecuteSequence。您目前使用

<Custom Action='LaunchUpdaterRunFirst' After='InstallInitialize' />

但是那时文件还没有被复制。所以我认为你必须使用以下之一:

<Custom Action='LaunchUpdaterRunFirst' After='InstallFiles' />
<Custom Action='LaunchUpdaterRunFirst' Before='ConfigureIIs' />
相关问题