Bootstrapper:如何在单个 .msi 包中编译应用程序和先决条件? [英] Bootstrapper: How to compile the application and prerequisite in single .msi package?

查看:25
本文介绍了Bootstrapper:如何在单个 .msi 包中编译应用程序和先决条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为具有安装先决条件的应用程序创建一个 .msi 包.我正在使用 Visual Studio 2005 Bootstrapper 来完成这项任务.为此,我做了以下工作:找到文件夹 C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ 并为我的先决条件创建了一个文件夹(使其结构与dotnetfx"相同);创建了product.xml"和package.xml"并适当地放置了它们.到目前为止,我保持 xml 文件非常简单以测试安装:

产品.xml

</命令></产品>

package.xml

</字符串></包>

现在我可以从列表中添加先决条件并构建我的安装项目.

问题:

构建输出是setup.exe"、MyApp.msi"包,以及包含MyPrereq.exe"的名为MyPrereq"的子文件夹.

我希望构建创建一个setup.exe"和一个MyApp.msi",其中包含MyPrereq",没有其他文件/目录.

我知道 .NET 框架是我的应用程序的另一个先决条件,它包含在同一个 .msi 中,因此应该可以以某种方式实现.

我怎样才能做到这一点?

解决方案

您可以使用 IExpress(Windows 附带)等工具创建自解压安装程序,其中包含单个可执行文件中的所有文件(请参阅 此 SO 发布).

您不能让 MSI 文件安装自己的先决条件.首先,因为 Windows Installer 本身是先决条件(并且必须由非 MSI exe 安装),其次是因为 Windows Installer 安装是事务性的,不支持 MSI 文件的链式执行.这基本上意味着一个 MSI 安装无法启动另一个 MSI 安装.因此,任何先决条件都必须由单独的引导程序安装(顺便说一下,安装不再是事务性的 - 如果您的 MSI 安装失败,则不会卸载先决条件).

不过,似乎对引导程序机制存在基本的误解.引导程序当前只能由 Visual Studio 或 MSBuild 生成.Afaik WiX 是不可能的.在 MSBuild 中查找 GenerateBootstrapper 任务(请参阅此 SO 发布).

I am creating an .msi package for the application which has a prerequisite for installation. I am using the Visual Studio 2005 Bootstrapper for this task. To this end, I did the following: Located the folder C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ and created a folder for my prerequisite (made it same structure as 'dotnetfx'); created the 'product.xml' and 'package.xml' and placed them appropriately. I kept the xml files very simple so far to test the installation:

product.xml

<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="MyPrereq" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="MyPrereq.exe" />
  </PackageFiles>
  <InstallChecks>
  </InstallChecks>
  <Commands Reboot="None">
    <Command PackageFile="MyPrereq.exe" EstimatedInstallSeconds="90">
      <InstallConditions>
      </InstallConditions>
      <ExitCodes>
    <ExitCode Value="0" Result="Success"/>
        <DefaultExitCode Result="Fail" String="GeneralFailure" FormatMessageFromSystem="true" />
      </ExitCodes>
    </Command>
  </Commands>
</Product>

package.xml

<?xml version="1.0" encoding="utf-8"?>
<Package Name="MyPrereq" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
  <Strings>
    <String Name="Culture">en</String>
    <String Name="DisplayName">MyPrereq</String>
    <String Name="GeneralFailure">A fatal error occurred. The installation failed.</String>
  </Strings>
</Package>

Now I can add the prerequisite from the list and build my setup project.

The problem:

The build output is the 'setup.exe', the 'MyApp.msi' package, plus the subfolder called 'MyPrereq' which contains 'MyPrereq.exe'.

I would like the build to create a 'setup.exe' and a single 'MyApp.msi', which would contain the 'MyPrereq' inside, with no additional files/directories.

I know that the .NET framework is another prereq for my app, and it is included in the same .msi, so that should be possible somehow.

How can I achieve this?

解决方案

You can create a self-extracting installer with tools such as IExpress (coming with Windows) containing all files in a single executable (see this SO posting).

You cannot have an MSI file installing its own pre-requisites. First, because Windows Installer itself is a pre-requisite (and must be installed by a non MSI exe) and second because Windows Installer installations are transactional and don't support the chained execution of MSI files. This basically means that one MSI installation cannot start another MSI installation. As a consequence, any pre-requisites must be installed by a separate bootstrapper (by the way, the installation is no longer transactional - the pre-requisites won't get uninstalled if your MSI installation fails).

There seems to be a basic mis-understanding about the bootstrapper mechanism though. The bootstrapper can currently only be generated by Visual Studio or MSBuild. Afaik it is not possible with WiX. Look for the GenerateBootstrapper task in MSBuild (see this SO posting).

这篇关于Bootstrapper:如何在单个 .msi 包中编译应用程序和先决条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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