简体   繁体   English

如何在WIX中包含msi / Setup.exe的先决条件

[英]How to include prerequisites with msi/Setup.exe in WIX

I'm trying to combine my package in a single setup EXE file and upload it to the Internet. 我正在尝试将我的包组合在一个设置EXE文件中并将其上传到Internet。

I have created a Microsoft bootstrapper that contains Setup.exe with project MSI output, and pre-requisite .NET Framework 2.0, Windows Installer 3.1 , Visual C++ 2005 redistributables, and Microsoft ReportViewer . 我创建了一个Microsoft引导程序,其中包含带有项目MSI输出的Setup.exe,以及必备的.NET Framework 2.0, Windows Installer 3.1, Visual C ++ 2005可再发行组件和Microsoft ReportViewer I have created a setup project using Visual Studio 2008 . 我使用Visual Studio 2008创建了一个安装项目。

Now I'm trying to create a single compressed setup using WiX 3.6. 现在我正在尝试使用WiX 3.6创建单个压缩设置。 I have installed it in Visual Studio 2008. 我已经在Visual Studio 2008中安装了它。

I have attached the setup.exe and MSI file using following commands. 我使用以下命令附加了setup.exe和MSI文件。

<ExePackage SourceFile ="setup.exe" Compressed ="yes"/>
<MsiPackage SourceFile ="myproject.msi" Compressed ="yes" />

But it is unable to find the MSI file. 但它无法找到MSI文件。 How can I include the above prerequisites with it? 我怎样才能包含上述先决条件?

Or can I download the above prerequisites from the Internet while installing? 或者我可以在安装时从Internet下载上述先决条件吗? How do I do it? 我该怎么做?

I have removed the default setup.exe from Visual Studio and used the MSI file and dependencies from Visual Studio to create a WiX 3.6 Bootstrapper: 我从Visual Studio中删除了默认的setup.exe ,并使用Visual Studio中的MSI文件和依赖项创建了一个WiX 3.6 Bootstrapper:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Bundle Name="My Application"
            Version="1.0"
            IconSourceFile ="E:\logo.ico"
            Manufacturer="My company"
            UpgradeCode="4dcab09d-baba-4837-a913-1206e4c2e743">

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
            <bal:WixStandardBootstrapperApplication
                LicenseFile="E:\License.rtf"
                SuppressOptionsUI ="yes"
                LogoFile ="logo.ico" />
        </BootstrapperApplicationRef>

        <Chain>
            <ExePackage
                SourceFile ="ReportViewer\ReportViewer.exe"
                Compressed ="yes"
                Vital ="no"
                Permanent ="yes"/>
            <ExePackage
                SourceFile ="vcredist_x86\vcredist_x86.exe"
                Compressed ="yes"
                Vital ="no"
                Permanent ="yes"/>
            <MsiPackage
                SourceFile ="MySetup.msi"
                Compressed ="yes"
                DisplayName ="My Application"
                ForcePerMachine ="yes"/>
        </Chain>
    </Bundle>
</Wix>

It compresses into an single EXE file with prerequisites. 它压缩为具有先决条件的单个EXE文件。

SourceFile will accept a relative path the .msi file. SourceFile将接受.msi文件的相对路径。 Or, if you are building the .msi file with a WiX Setup project, you can add a reference to the Setup project in the WiX Bootstrapper project. 或者,如果要使用WiX安装项目构建.msi文件,则可以在WiX Bootstrapper项目中添加对安装项目的引用。 That defines variables you can use like this: 它定义了你可以使用的变量 ,如下所示:

<MsiPackage SourceFile ="$(var.myproject.TargetPath)" Compressed ="yes" />

Your users will probably have a better experience if you drop the Visual Studio Bootstrapper and put all prerequisites in the WiX Bootstrapper. 如果删除Visual Studio Bootstrapper并将所有先决条件放在WiX Bootstrapper中,您的用户可能会获得更好的体验。 It'll be a little more work for you because there isn't a pre-defined ExePackageGroup or ExePackage for all of your project's prerequisites. 对您而言,这将是一项更多的工作,因为没有预先定义的ExePackageGroupExePackage用于您的所有项目的先决条件。

The best place to check for information on what should go into an ExePackage definition is the documentation for the particular prerequisite in question. 检查有关ExePackage定义内容的信息的最佳位置是有关特定先决条件的文档。 But, it is also instructive to compare with the Visual Studio Bootstrapper packages (in, eg, C:\\Program Files\\Microsoft Visual Studio 9\\SDK\\v2.0\\Bootstrapper\\Packages ) and similar prerequisites that might be predefined in the WiX source code. 但是,与Visual Studio Bootstrapper软件包(例如, C:\\Program Files\\Microsoft Visual Studio 9\\SDK\\v2.0\\Bootstrapper\\Packages )以及可能在WiX中预定义的类似先决条件进行比较也具有指导意义。源代码。 In particular, in the WiX source code, you will find an ExePackage that downloads .NET 4 from the Internet if needed while installing. 特别是,在WiX源代码中,您将找到一个ExePackage ,在安装时根据需要从Internet下载.NET 4。

You can include some pre-requisite file with something like: 您可以包含一些先决条件文件,例如:

 <?xml version="1.0" encoding="UTF-8"?>
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
 <Product Id="*" Name="MyApplication" Version="$(var.ProductVersion)" Manufacturer="manuf" Language="1033">

 [...]

 <Directory Id="ANOTHERLOCATION" Name="MyApplicationName">
    <Component Id="ApplicationFiles" Guid="12345678-1234-1234-1235-111111111111">
         <File Id="ApplicationFile4" Source="C:\Users\user\Desktop\requisite.exe"/>
         <CreateFolder />
    </Component>
 </Directory>
 <SetDirectory Id="ANOTHERLOCATION" Value="[WindowsVolume]MyApp" />
         <Feature Id="DefaultFeature" Level="1">
        <ComponentRef Id="ApplicationFiles" />
 </Feature>
 </Product>
 </Wix>

The above copies the requisite.exe file inside C:/MyApp. 以上复制C:/ MyApp中的requisite.exe文件。 You then have to run the requisite.exe file from your program based on some conditions. 然后,您必须根据某些条件从程序中运行requisite.exe文件。 This is the most basic and straight-forward way without using complicated Wix wizardry. 这是不使用复杂的Wix魔法的最基本和最直接的方式。

You can use something like NSIS to wrap up your bootstrapper and MSI. 您可以使用类似NSIS的东西来包装您的引导程序和MSI。 You'll need to write a simple NSIS script, like this: 您需要编写一个简单的NSIS脚本,如下所示:

!define PRODUCT_NAME "YourProductNameHere"

Name "${PRODUCT_NAME}"
OutFile "SetupWrapper.exe"
Icon "Setup.ico"
BrandingText " "
SilentInstall silent

Section

  SetOutPath "$TEMP\${PRODUCT_NAME}"

  ; Add all files that your installer needs here
  File "setup.exe"
  File "product.msi"

  ExecWait "$TEMP\${PRODUCT_NAME}\setup.exe"
  RMDir /r /REBOOTOK "$TEMP\${PRODUCT_NAME}"

SectionEnd

Save this to a file named SetupWrapper.nsi, and edit the product name and paths to setup.exe and your MSI file. 将其保存到名为SetupWrapper.nsi的文件中,并编辑setup.exe和MSI文件的产品名称和路径。 Now you can build this file to get a single EXE file that contains the bootstrapper and the MSI. 现在,您可以构建此文件以获取包含引导程序和MSI的单个EXE文件。

When this EXE is run, it will not have any UI of its own -- it will simply extract your bootstrapper and MSI to a temp folder, then execute the bootstrapper, and clean up afterwards. 运行此EXE时,它将没有自己的任何UI - 它只会将您的引导程序和MSI提取到临时文件夹,然后执行引导程序,然后进行清理。

You can also add a post-build step to your project to build this wrapper, which will automatically generate the combined wrapper EXE. 您还可以在项目中添加一个构建后步骤来构建此包装器,它将自动生成组合的包装器EXE。 To do this, you can add a command like this: 为此,您可以添加如下命令:

path-to-NSIS\nsis-2.46\makensis.exe /V2 your-project-path\SetupWrapper.nsi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WiX:如何将setup.exe添加到现有的MSI? - WiX: how to add setup.exe to the existing MSI? WIX - 构建包含 32 位和 64 位 MSI 的 setup.exe 包 - WIX - Build a setup.exe bundle which hold both 32 bit and 64 bit MSI 如何在Wix安装项目中包含MSI文件 - How to include a msi file in a Wix setup project Wix-Installer-如何获取setup.exe的当前目录? - Wix-Installer-How can I get setup.exe's current directory? WiX Toolset安装的结果应为EXE和MSI - Result of WiX Toolset setup should be EXE and MSI 如何在WIX 3.6中使用msi软件包检查必备组件的安装条件 - How to check install conditions for prerequisites with msi package in WIX 3.6 为什么setup.exe没有显示ARPCOMMENTS和WIXUIBanner.bmp但是setup.msi显示了这个东西? - Why setup.exe is not showing the ARPCOMMENTS & WIXUIBanner.bmp but the setup.msi is showing this stuff? 引导程序(setup.exe)提示“未找到.NET 3.5”,但启动.msi可直接安装应用程序而不会出现问题 - Bootstrapper (setup.exe) says “.NET 3.5 not found” but launching .msi directly installs application without problem 如何使用wix在msi安装程序中包含文件? - How to include files in an msi installer using wix? "Wix Bootstrapper setup.exe 从不启动并记录读取无法加载主题控件" - Wix Bootstrapper setup.exe never starts and log reads Failed to load theme controls
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM