-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bootstrap condition via variable #1219
Comments
This is how i did it: In theme.xml i add MyCheckbox <Page Name="Install">
<Richedit Name="EulaRichedit" X="11" Y="80" Width="-11" Height="-110" TabStop="yes" FontId="0" HexStyle="0x800000" />
<Checkbox Name="EulaAcceptCheckbox" X="11" Y="270" Width="300" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
<Checkbox Name="MyCheckbox" X="11" Y="290" Width="300" Height="17" TabStop="yes" FontId="3" >#(loc.MyCheckLabel)</Checkbox>
<Button Name="OptionsButton" X="-201" Y="-11" Width="85" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-111" Y="-11" Width="85" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-21" Y="-11" Width="85" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>
</Page> Then added in bundle a property with the same name as the checkbox bundle.Variables = new[] {
new Variable("MyCheckbox", "0", VariableType.numeric) { Overridable = true }
}; And then add Msi package with install condition: bundle.Chain.Add(new MsiPackage(msiPath) { Compressed = Compressed, InstallCondition = "MyCheckbox<>0" }); |
How did you include "theme.xml" in the project? Can you share your solution? |
@oleg-shilo included the theme file as in the example. Add AttributesDefinition in Application : var itemsDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) ?? string.Empty;
var bundle = new Bundle(bundleName)
{
Manufacturer = "MyCompany",
UpgradeCode = new Guid(guid),
Version = version,
IconFile = Path.Combine(itemsDir, iconName),
Application = new LicenseBootstrapperApplication
{
LicensePath = Path.Combine(itemsDir, "license.rtf"),
LocalizationFile = Path.Combine(itemsDir, "mbapreq.wxl"),
//this atribute add theme
AttributesDefinition = $"ThemeFile={Path.Combine(itemsDir, "RtfTheme.xml")}; ShowVersion=yes; ShowFilesInUse=yes",
LogoFile = Path.Combine(itemsDir, "logo64.png"),
},
SuppressWixMbaPrereqVars = true
};
bundle.Variables = new[] {
new Variable("MyCheckbox", "0", VariableType.numeric) { Overridable = true }
};
bundle.Chain.Add(new MsiPackage(msiPath) { Compressed = Compressed, InstallCondition = "MyCheckbox<>0" }); |
Excellent. Thank you. |
By the way, something else might be useful. string installDir = Path.Combine(Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%"), CompanyName, AppName);
var bundle = new Bundle(bundleName)
{
//some properties here
};
bundle.Variables = new[] {
new Variable("MyInstallDir", installDir) { Overridable = true }
};
bundle.Chain.Add(new MsiPackage(msiPath) { MsiProperties = "INSTALLDIR=[MyInstallDir]" }); And set for Editbox value is variable [MyInstallDir] in theme.xml <Page Name="Options">
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Text>
<Text X="11" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OptionsLocationLabel)</Text>
<Editbox Name="FolderEditbox" X="11" Y="143" Width="-91" Height="21" FontId="3" FileSystemAutoComplete="yes">[MyInstallDir]</Editbox>
<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" FontId="3">#(loc.OptionsBrowseButton)</Button>
<Button Name="OptionsOkButton" X="-116" Y="-11" Width="95" Height="30" FontId="0">#(loc.OptionsOkButton)</Button>
<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="95" Height="30" FontId="0">#(loc.OptionsCancelButton)</Button>
</Page> This adds in the option page the default path is not empty |
Great. Txs. I am adding your sample in the samples library now. And the next question: "where you defined MyCheckLabel?". Is it coming from the custom WXL? |
Change InstallDir not work in bundle 😞 |
Hm, indeed it does not. Though the whole idea of "options" page is to push user choice to the individual installers. This post makes me think that it is a bug in the Burn: https://stackoverflow.com/questions/40882567/why-cant-the-install-location-be-selected-from-browse-directory-panel-in-burn |
It appears that 'options' page uses a special built-in variable Your code needs to be changed like this: bundle.Chain.Add(new MsiPackage(msiPath) { MsiProperties = "INSTALLDIR=[InstallFolder]" }); I have also updated the sample with your scenario: 84ce7ff |
- Issue #1244: The directory Id generated can be too long - Issue #1223: Non LegacyDummyDirAlgorithm creates C:\ProgramFilesFolder empty folder - Issue #1220: ElevatedManagedAction issue - Feature #1204: Feature - RegisterCom class to ease the registration of COM files - Issue #1203: SilentBootstrapperApplication - Issue #182 (extended solution): RegistrySearch has "Win64=no" when building x64 installers - Added Self-executable_Msi sample - Added WixBootstrapper_EmbeddedUI to demonstrate how to show managed UI if the bundled MSI - Added sample for customization of the stock Burn UI. Triggered by #1219 - Added sample for "Issue #1218: Dynamic custom UI sequence" - Resurrected setting user input from BA UI and passing it to the msi. RegistrySearch input is also retained. - Added validation for `Issue #1075: [FEAT] Add error if LaunchApplicationFromExitDialog using in common Project` error. - Fixed problem with RegKey being placed in the x86 root XML dir for the x64 project
Bundle has the ability to set a condition for installing the package through a search in the registry.
example:
Is there a similar possibility for setting condition from session variable?
I want to add a checkbox to the theme bundle, which will mean whether to install some feature or not
The text was updated successfully, but these errors were encountered: