问题
In our installer, we want to deploy one of two files, according to a decision that the user should make during the installation.
I am able to change the property during run-time, via a WixForm
using radio buttons, and even to confirm that the bound property indeed changes (using a CustomAction
that shows a MessageBox
, checking the expressions session.EvaluateCondition($"TYPE_OF_PKG=\"ABC\"")
and session.EvaluateCondition($"TYPE_OF_PKG=\"XYZ\"")
).
However, it doesn't seem to affect the conditioned files - they are simply not deployed (unless I explicitly set the "TYPE_OF_PKG"
Property
's value to e.g. "ABC"
instead of "NONE"
).
These are the two feature, abcFeature
and xyzFeature
:
var abcFeature = new Feature("ABC_PKG") {
Condition = new FeatureCondition($"TYPE_OF_PKG=\"ABC\"", 1),
Attributes = {["AllowAdvertise"] = "no"},
AllowChange = true,
IsEnabled = false,
};
var xyzFeature = new Feature("XYZ_PKG") {
Condition = new FeatureCondition($"TYPE_OF_PKG=\"XYZ\"", 1)
Attributes = {["AllowAdvertise"] = "no"},
AllowChange = true,
IsEnabled = false,
};
And that's the project definition:
var files = new WixObject[] { new File(abcFeature, "abc.exe"), new File(xyzFeature, "xyz.exe") };
new Project(myPorjectName, files)
{
Properties = new[] { new Property("TYPE_OF_PKG", "NONE") { AttributesDefinition = @"Secure = yes" }
Features = new[] { abcFeature, xyzFeature },
CustomUI = CustomUIBuilder.BuildPostLicenseDialogUI
(
dialogDefinition,
new DialogAction[] { new ShowDialog(NativeDialogs.InstallDirDlg) }
),
}
Where in dialogDefinition
(inherited from WixForm
), we have two radio-buttons, bound to the TYPE_OF_PKG
property, to display the option to the user (and change its value per the user's decision):
this.RadioButtonsGroup.BoundProperty = "TYPE_OF_PKG";
this.RadioButtonsGroup.ControlType = WixSharp.Controls.ControlType.RadioButtonGroup;
this.RadioButtonsGroup.EmbeddedXML = @"
<RadioButtonGroup Property=""TYPE_OF_PKG"">
<RadioButton Value=""ABC"" X=""0"" Y=""0"" Width=""400"" Height=""20"" Text=""ABC"" />
<RadioButton Value=""XYZ"" X=""0"" Y=""20"" Width=""400"" Height=""20"" Text=""XYZ"" />
</RadioButtonGroup>";
this.RadioButtonsGroup.Hidden = false;
this.RadioButtonsGroup.Id = "RadioButtonsGroup";
this.RadioButtonsGroup.Location = new System.Drawing.Point(12, 69);
this.RadioButtonsGroup.Name = "RadioButtonsGroup";
this.RadioButtonsGroup.Size = new System.Drawing.Size(466, 125);
this.RadioButtonsGroup.Text = "What to install .wixText?";
this.RadioButtonsGroup.Tooltip = null;
this.RadioButtonsGroup.WixAttributes = null;
this.RadioButtonsGroup.WixText = "What to install .wixText?";
Any idea how to make the selected file deployed?
来源:https://stackoverflow.com/questions/57993267/property-seems-to-change-per-users-selection-but-conditioned-files-are-not-bei