1

我正在尝试在使用 WIX 安装 MSI 时部署和运行应用程序(C# 控制台应用程序),但遇到了一些困难。

应用程序需要在任何网络服务器操作发生之前但在文件从 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" />

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

4

2 回答 2

-1

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

<Product ......>

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

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

</Product>
于 2010-05-18T10:35:25.577 回答
-2

See the WiX InstallExecuteSequence. You currently use

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

But at that moment the files are not copied yet. So I think you must use one of the following:

<Custom Action='LaunchUpdaterRunFirst' After='InstallFiles' />
<Custom Action='LaunchUpdaterRunFirst' Before='ConfigureIIs' />
于 2010-07-30T17:21:59.507 回答