如何在 WIX 中安装期间静默运行另一个程序(PostgreSQL)的安装程序?

发布于 2024-08-16 14:15:45 字数 150 浏览 4 评论 0原文

我的公司正在开发一个依赖于 PostgreSQL 的应用程序,我们正在使用 WIX 开发安装程序。我们怎样才能让 PostgreSQL 安装程序(也是一个 msi 文件)在安装我们的应用程序时自动运行?我们需要在Wix中设置什么?如果您碰巧知道任何网页解释了这一点,请发布链接。谢谢你!

My company is developing an application that has a dependency on PostgreSQL, we are developping the installer by using WIX. How can we make the PostgreSQL installer (which is also a msi file) run automatically when installing our application? What do we need to set in Wix? If you happen to know any webpage explains this, please post the link. Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

︶葆Ⅱㄣ 2024-08-23 14:15:45

这是我编写的一个引导程序,用于将 MSXML 6 添加到我们的一个安装程序中。以下网站对于帮助我了解需要做什么至关重要,并且可能能够填补您可能存在的任何空白:
http://msdn.microsoft.com/en- us/library/aa730839%28VS.80%29.aspx

特别是对于有关让安装程序以静默方式运行的问题,您需要向 Command 元素的 @Arguments 属性添加适当的开关,这可能会看起来像这样:

<Command PackageFile="PostgreSQL.msi" Arugments="/quiet"/>

您还需要找到您正在使用的 MSI(使用 MS Orca)的 ProductCode,以确保引导程序不会在已安装 PostgreSQL 的情况下尝试运行安装:

<InstallChecks>
  <MsiProductCheck 
      Property="IsPostgresInstalled" 
      Product="{PRODUCT-CODE-OF-POSTGRESQL-MSI}"/> 
</InstallChecks>

product.xml:

<Product
    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    ProductCode="Microsoft.MSXML.6.SP2">

  <PackageFiles>
    <PackageFile Name="msxml6-KB954459-enu-x86.exe"/>
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck 
        Property="IsMsiInstalled" 
        Product="{1A528690-6A2D-4BC5-B143-8C4AE8D19D96}"/>
  </InstallChecks>

  <Commands>
    <Command PackageFile="msxml6-KB954459-enu-x86.exe" Arguments="">
      <InstallConditions>
        <BypassIf 
            Property="IsMsiInstalled" 
            Compare="ValueGreaterThan" Value="0"/>
        <FailIf Property="AdminUser" 
                Compare="ValueNotEqualTo" Value="True"
                String="NotAnAdmin"/>
      </InstallConditions> 

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" String="GeneralFailure"/>
      </ExitCodes>
    </Command>
  </Commands>
</Product>

这是项目我运行 MSBuild 的方法:

<Project ToolsVersion="3.5"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <ItemGroup>
    <BootstrapperFile Include="Microsoft.MSXML.6.SP2" >
      <ProductName>Microsoft MSXML 6 SP2</ProductName>
    </BootstrapperFile>
  </ItemGroup>

  <Target Name="setup">
    <GenerateBootstrapper
        ApplicationFile="@PROJECT-EXE@"
        ApplicationName="@PROJECT@"
        BootstrapperItems="@(BootstrapperFile)"
        Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper"
        ComponentsLocation="Relative"
        OutputPath="."
        Culture="de"/>
  </Target>

</Project>

我希望这会有所帮助。

Here's a bootstrapper I wrote to add MSXML 6 to one of our installers. The following website was crucial in helping me understand what needed to be done, and might be able to fill in any blanks that you might have:
http://msdn.microsoft.com/en-us/library/aa730839%28VS.80%29.aspx

Specifically for your question about getting the installer to run silently, you will need to add the proper switches to the @Arguments attribute of the Command element, which will probably look something like:

<Command PackageFile="PostgreSQL.msi" Arugments="/quiet"/>

You will also need to find the ProductCode of the MSI you are using (using MS Orca) to make sure that the bootstrapper does not try to run the installation if PostgreSQL is already installed:

<InstallChecks>
  <MsiProductCheck 
      Property="IsPostgresInstalled" 
      Product="{PRODUCT-CODE-OF-POSTGRESQL-MSI}"/> 
</InstallChecks>

product.xml:

<Product
    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    ProductCode="Microsoft.MSXML.6.SP2">

  <PackageFiles>
    <PackageFile Name="msxml6-KB954459-enu-x86.exe"/>
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck 
        Property="IsMsiInstalled" 
        Product="{1A528690-6A2D-4BC5-B143-8C4AE8D19D96}"/>
  </InstallChecks>

  <Commands>
    <Command PackageFile="msxml6-KB954459-enu-x86.exe" Arguments="">
      <InstallConditions>
        <BypassIf 
            Property="IsMsiInstalled" 
            Compare="ValueGreaterThan" Value="0"/>
        <FailIf Property="AdminUser" 
                Compare="ValueNotEqualTo" Value="True"
                String="NotAnAdmin"/>
      </InstallConditions> 

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" String="GeneralFailure"/>
      </ExitCodes>
    </Command>
  </Commands>
</Product>

Here is the project that I run MSBuild with:

<Project ToolsVersion="3.5"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <ItemGroup>
    <BootstrapperFile Include="Microsoft.MSXML.6.SP2" >
      <ProductName>Microsoft MSXML 6 SP2</ProductName>
    </BootstrapperFile>
  </ItemGroup>

  <Target Name="setup">
    <GenerateBootstrapper
        ApplicationFile="@PROJECT-EXE@"
        ApplicationName="@PROJECT@"
        BootstrapperItems="@(BootstrapperFile)"
        Path="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper"
        ComponentsLocation="Relative"
        OutputPath="."
        Culture="de"/>
  </Target>

</Project>

I hope this helps.

笔芯 2024-08-23 14:15:45

一个 Windows Installer 会话无法启动另一个 Windows Installer 会话,因此一个 msi 无法安装另一个 msi。因此,您需要创建第三个应用程序,即引导程序,它会安装两个 MSI 文件。

要创建这样的引导程序,您可以使用 msbuild 的 generatebootstrapper 任务。 wix 文档已经介绍了如何使用此任务来生成安装 .NET 框架的引导程序。请参阅如何:使用引导程序安装 .NET Framework。这利用了 .NET 框架的预定义引导程序包。

但是,在这种情况下,您还必须为 PostgreSQL msi 编写自己的引导程序包。一种方法是研究 C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ 中的现有引导程序包(或 Windows SDK)并阅读Bootstrapper Manifest XML 格式的文档引导程序生成器工具也可能会有所帮助。

您可能认为这相当复杂。有关生成引导程序的更简单替代方案,请查看 dotNetInstaller,它实际上是一个通用引导程序生成器。它看起来很光滑,但我还没有任何实践经验。

One Windows Installer session cannot launch another one, so one msi cannot install another msi. Therefore you need to make a third application, a bootstrapper, which installs both MSI files.

To create such a bootstrapper you can use msbuild's generatebootstrapper task. The wix documentation already covers how to use this task to generate a bootstrapper that installs the .NET framework. See How To: Install the .NET Framework Using a Bootstrapper. This makes use of the pre-defined bootstrapper packages for the .NET framework.

However, in this case you will also have to author your own bootstrapper package for the PostgreSQL msi. One way to do this is to study the existing bootstrapper packages in C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ (or the ones in the Windows SDK) and read the documentation of the Bootstrapper Manifest XML format. The bootstrapper generator tool might also be helpful.

You might think this is all rather complicated. For a simpler alternative for generating bootstrappers, take a look at dotNetInstaller, which is actually a general purpose bootstrapper generator. It looks slick but I don't have any hands-on experience with it yet.

探春 2024-08-23 14:15:45

您无法同时运行两个 MSI 安装,您需要一个单独的引导程序来依次安装每个 MSI。

You can't run two MSI installations at once, you'll need a separate bootstrapper that installs each MSI in turn.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文