Is it possible to include a Msi package into the bootstrapper but not any of it's external files?
So my msi installer has a file:
<Component Directory="INSTALLDIR">
<File Id="DatabaseBackup"
Name="Database.bak"
Source="Database.bak"
Compressed="no" />
</Component>
which outputs:
Installer.msi
Database.bak
Now if I set the burn chain to include the msi package:
<MsiPackage SourceFile="$(var.Installer.TargetPath)" />
the "Database.bak" file is also compressed into the resultant exe. Is it possible to compress the msi but not the .bak file?
If not can someone answer this question better than I can then I won't need to do this at all! :)
I've used the Payload element for this purpose... in your example I would change the MsiPackage element to:
<MsiPackage SourceFile="$(var.Installer.TargetPath)" >
<Payload Compressed="no" SourceFile="{path_to_bak_file}\Database.bak" />
</MsiPackage>
The MSI then picks up the file and uses it as expected.
I haven't found a way to make this conditional or flexible.. in my case it's a config file that is not critical, but my setup now fails (first opens up a file open dialog looking for that file) if the file is missing - of course this depends on the details of the MSI I've created.
Hope this helps
Related
I have a component
<Component Id="ProductComponent" Guid="7935315f-4242-4c7a-a02c-6fd256805356">
<CreateFolder/>
<File
Id="propFile"
Name="aaa.properties"
DiskId="1"
Source="$(var.Project.TargetDir)"
Vital="yes"
KeyPath="yes" ></File>
<?endif?>
</Component>
I want to copy the file just on install , not upgrade.
But I can't find how to do it.
Any idea?
Have you tried using Condition element. I think you can provide a Condition inside Component element to check whether product is already installed or not. If not installed, then create file.
<Component Id="ProductComponent" Guid="7935315f-4242-4c7a-a02c-6fd256805356">
<Condition> NOT Installed </Condition>
<CreateFolder/>
<File
Id="propFile"
Name="aaa.properties"
DiskId="1"
Source="$(var.Project.TargetDir)"
Vital="yes"
KeyPath="yes" ></File>
</Component>
This is a weak spot of MSI (which WiX uses).
MSI installs a file
User modifies the file
MSI goes to install the file. Should it:
a) overwrite and lose user data
b) not overwrite and lose new applciation data
c) merge --- MSI doesn't support this.
If the user data is only one or few attributes there are tricks with custom actions to harvest the user data and reapply it but this is very tricky stuff.
IMO, the best way to approach this is never keep user data in a file installed by the installer. Take app.config appSettings element as an example. It was an atttribute that allows you to extend the file with another file that overrides the settings in the first file. Using this pattern the installer can lay down the app config and the application can create the override file and everything just works because MSI doesn't have to deal with the problem at all.
I am trying to use Wix Toolset 3.10 to install a small app. The thing I am having trouble with it getting it to launch a third-party .exe that is an optional feature.
Here is the related code in my Product.wxs file:
<Feature Id="iCalSetup" Title="Automation" Level="2">
<ComponentRef Id="icalsetup"/>
</Feature>
<Component Id="icalsetup" Guid="*" Directory="PRODUCTFOLDER">
<File Id="icalsetup" Name="foo.exe" Source="$(var.*****.TargetDir)foo.exe" KeyPath="yes"/>
</Component>
I am wrapping the ending msi in a bootstrapper application. to generate a .exe. The feature/selection tree shows the optional components correctly, but the .exe is never executed when it is selected. Please help!
I found a way to accomplish what I was looking to do. The .exe I was using was a self-extracting executable. I extracted it and created component groups for the extracted files. then I put an MsiPackage in the Bootstrapper app. if the component groups are not copied over, then the msi does not run.
I'm tring to generate EXE file from MSI in Wix installer, I added a new project (Bootstrapper) but I can specifying the path of my MSI file
<Bundle Name="Bootstrapper" Version="1.0.0.0" Manufacturer="" UpgradeCode="e45fdbb6-192c-46f7-b4db-d04af69edada">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<MsiPackage SourceFile="WixSetup.msi" />
</Chain>
</Bundle>
Can you help ?
Thanks in advance
Abdulsalam
Add a reference of your msi's wixproj to your bootstrapper application.
You can now reference the msi file like this
<MsiPackage SourceFile="$(var.WixProjName.TargetPath)" />
This will automatically point to the debug location or release location depending on your build mode.
You can see a list of well-defined vars passed to candle.exe in the output when building. You'll see a bunch of defines like "-dWixProjName.Property=Value" and then you can use those values in your bundle xml like so $(var.WixProjName.Property) which will get replaced by the Value before compiling.
You can see a list of the defined properties when you reference another project here: http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html
In the Product.wxs, I set Schedule="afterInstallInitialize" in the MajorUpgrade so that if the installation fails, it will roll back to the previous version.
Our Windows Service uses app.config that the installer copied to the installed machine.
We do this by including the below line in the Product.wxs:
<Component Id="Config" Win64="yes">
<File Source="$(var.WixWindowsService2012.TargetDir)WixWindowsService2012.exe.config"
Name="WixWindowsService2012.exe.config"
Vital="yes" KeyPath="yes" />
</Component>
We only want to copy this app.config file on the first installation, and we do NOT want to copy it in the subsequent installations.
When I comment out the above Component element in the Product.wxs, the installation failed because during installation, it deletes the app.config on the installed folder, and since the Windows Service requires it to run, the installation fails.
How can I make the installation to not copy the app.config to the installed folder if app.config already exists there ?
Thank you.
The problem is that the RemoveExistingProducts of the upgrade is removing the file, then the incoming upgrade installs the new one, as discussed in the WiX mailing list. RemoveExistingProducts needs to be just before InstallFinalize and after InstallExecute at the end.
I'm trying to combine my package in a single setup EXE file and upload it to the 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. I have created a setup project using Visual Studio 2008.
Now I'm trying to create a single compressed setup using WiX 3.6. I have installed it in Visual Studio 2008.
I have attached the setup.exe and MSI file using following commands.
<ExePackage SourceFile ="setup.exe" Compressed ="yes"/>
<MsiPackage SourceFile ="myproject.msi" Compressed ="yes" />
But it is unable to find the MSI file. How can I include the above prerequisites with it?
Or can I download the above prerequisites from the Internet while installing? 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:
<?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.
SourceFile will accept a relative path the .msi file. 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. 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. 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.
The best place to check for information on what should go into an ExePackage definition is the documentation for the particular prerequisite in question. But, it is also instructive to compare with the Visual Studio Bootstrapper packages (in, e.g., C:\Program Files\Microsoft Visual Studio 9\SDK\v2.0\Bootstrapper\Packages) and similar prerequisites that might be predefined in the WiX source code. In particular, in the WiX source code, you will find an ExePackage that downloads .NET 4 from the Internet if needed while installing.
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.
You then have to run the requisite.exe file from your program based on some conditions.
This is the most basic and straight-forward way without using complicated Wix wizardry.
You can use something like NSIS to wrap up your bootstrapper and MSI. You'll need to write a simple NSIS script, like this:
!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. Now you can build this file to get a single EXE file that contains the bootstrapper and the MSI.
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.
You can also add a post-build step to your project to build this wrapper, which will automatically generate the combined wrapper 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