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 文件非常简单来测试安装:
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>
现在我可以从列表中添加先决条件并构建我的安装项目。
问题:
构建输出是“setup.exe”、“MyApp.msi”包,以及包含“MyPrereq.exe”的名为“MyPrereq”的子文件夹。
我希望构建创建一个“setup.exe”和一个“MyApp.msi”,其中包含“MyPrereq”,没有其他文件/目录。
我知道 .NET 框架是我的应用程序的另一个先决条件,并且它包含在同一个 .msi 中,因此应该可以以某种方式实现。
我怎样才能实现这个目标?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 IExpress(Windows 附带)等工具创建自解压安装程序,其中包含单个可执行文件中的所有文件(请参阅此所以发帖)。
您不能让 MSI 文件安装其自己的先决条件。 首先,因为 Windows Installer 本身是先决条件(并且必须由非 MSI exe 安装),其次因为 Windows Installer 安装是事务性的,并且不支持 MSI 文件的链式执行。 这基本上意味着一个 MSI 安装无法启动另一个 MSI 安装。 因此,任何先决条件都必须由单独的引导程序安装(顺便说一句,安装不再是事务性的 - 如果 MSI 安装失败,先决条件将不会被卸载)。
不过,对于引导程序机制似乎存在一个基本的误解。 引导程序当前只能由 Visual Studio 或 MSBuild 生成。 据我所知,WiX 是不可能的。 在 MSBuild 中查找GenerateBootstrapper 任务(请参阅此 SO 帖子)。
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).
我用 IExpress 成功做到了这一点。
然而,必须使用一个小技巧,如下所述
为 VS Shell 应用程序创建引导程序
问题是引导程序将先决条件放入子文件夹中,而 IExpress 无法识别子文件夹。 编辑“setup.exe”时也必须小心,第一次尝试时没有正确。
I managed to do that with IExpress.
Had to use a small trick, however, which is described here
Creating a bootstrapper for a VS Shell application
The problem was that bootstrapper puts the prerequisites into a subfolder, and IExpress does not recognise subfolders. Have to be careful while editing 'setup.exe' too, didn't get it correct on the first try.