How to enable prerequisites with msi / Setup.exe on WIX

I am trying to combine my package into one installation EXE file and upload it to the Internet.

I created a Microsoft boot file containing the Setup.exe file with the MSI project and the premise of the .NET Framework 2.0, Windows Installer , Visual C ++ Redistributable versions of 2005, and Microsoft ReportViewer . I created an installation project using Visual Studio 2008 .

Now I'm trying to create one concise setup using WiX 3.6. I installed it in Visual Studio 2008.

I installed the setup.exe and MSI file using the following commands.

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

But he can not find the MSI file. How can I include the above prerequisites in it?

Or can I download the above prerequisites from the Internet during installation? How to do it?

+4
source share
4 answers

I removed the default setup.exe from Visual Studio and used the MSI file and Visual Studio dependencies to create the WiX 3.6 boot buffer:

 <?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 is compressed into a single exe file with preconditions.

+5
source

SourceFile will accept the relative path to the .msi file. Or, if you create a .msi file with a WiX Setup project, you can add a link to the installation project in the WiX Bootstrapper project. This defines variables that you can use as follows:

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

Your users will probably have a better experience if you release Visual Studio Bootstrapper and put all the necessary conditions into the WiX Bootstrapper download. This will be a little more for you because for all of your project prerequisites there are no predefined ExePackageGroup or ExePackage .

The best place to check for information about what should be included in the ExePackage definition is documentation for the specific prerequisite. But it is also instructive to compare Visual Studio Bootstrapper packages (for example, C:\Program Files\Microsoft Visual Studio 9\SDK\v2.0\Bootstrapper\Packages ) and similar prerequisites that can be predefined in the WiX source code. In particular, in the WiX source code, you will find ExePackage , which downloads .NET 4 from the Internet, if necessary during installation.

+4
source

You can include some preliminary 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. Then you need to run the requisite.exe file from your program based on some conditions. This is the easiest and easiest way without using the complicated Wizard wizardry.

0
source

You can use something like NSIS to complete the download and MSI. You need to write a simple NSIS script, for example:

 !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 called SetupWrapper.nsi and edit the product name and paths to setup.exe and your MSI file. Now you can create this file to get one EXE file containing the bootloader and MSI.

When this EXE is launched, it will not have its own user interface - it will simply extract your boot block and MSI into a temporary folder, then launch the bootloader and clean it later.

You can also add a post-build step to your project to create this shell, which will automatically create a unified EXE shell. To do this, you can add the following command:

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

Source: https://habr.com/ru/post/1489701/


All Articles