From c258b72508f1b25a56e5d3ee3df08650ba1cbe36 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 4 Feb 2026 20:47:04 -0500 Subject: Support dual-purpose packages in Burn. Fixes https://github.com/wixtoolset/issues/issues/8958 --- .../BootstrapperCommand.cs | 7 ++++++ .../Engine.cs | 20 ++++++++-------- .../IBootstrapperCommand.cs | 5 ++++ .../IBootstrapperEngine.cs | 27 ++++++++++++++++++++-- .../IEngine.cs | 3 ++- 5 files changed, 48 insertions(+), 14 deletions(-) (limited to 'src/api/burn/WixToolset.BootstrapperApplicationApi') diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs index 612e8ce9..795a40d4 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/BootstrapperCommand.cs @@ -20,6 +20,7 @@ namespace WixToolset.BootstrapperApplicationApi [MarshalAs(UnmanagedType.I4)] internal int cbSize; [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; [MarshalAs(UnmanagedType.U4)] private readonly Display display; + [MarshalAs(UnmanagedType.U4)] private readonly BundleScope scope; private readonly IntPtr wzCommandLine; [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; @@ -39,6 +40,7 @@ namespace WixToolset.BootstrapperApplicationApi return new BootstrapperCommand( this.action, this.display, + this.scope, Marshal.PtrToStringUni(this.wzCommandLine), this.nCmdShow, this.resume, @@ -62,6 +64,7 @@ namespace WixToolset.BootstrapperApplicationApi public BootstrapperCommand( LaunchAction action, Display display, + BundleScope scope, string commandLine, int cmdShow, ResumeType resume, @@ -74,6 +77,7 @@ namespace WixToolset.BootstrapperApplicationApi { this.Action = action; this.Display = display; + this.Scope = scope; this.CommandLine = commandLine; this.CmdShow = cmdShow; this.Resume = resume; @@ -91,6 +95,9 @@ namespace WixToolset.BootstrapperApplicationApi /// public Display Display { get; } + /// + public BundleScope Scope { get; } + /// public string CommandLine { get; } diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs index 25413790..82978b7d 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/Engine.cs @@ -12,7 +12,7 @@ namespace WixToolset.BootstrapperApplicationApi /// public sealed class Engine : IEngine { - private IBootstrapperEngine engine; + private readonly IBootstrapperEngine engine; internal Engine(IBootstrapperEngine engine) { @@ -24,8 +24,7 @@ namespace WixToolset.BootstrapperApplicationApi { get { - int count; - this.engine.GetPackageCount(out count); + this.engine.GetPackageCount(out var count); return count; } @@ -110,8 +109,7 @@ namespace WixToolset.BootstrapperApplicationApi /// public bool EvaluateCondition(string condition) { - bool value; - this.engine.EvaluateCondition(condition, out value); + this.engine.EvaluateCondition(condition, out var value); return value; } @@ -247,9 +245,9 @@ namespace WixToolset.BootstrapperApplicationApi } /// - public void Plan(LaunchAction action) + public void Plan(LaunchAction action, BundleScope plannedScope) { - this.engine.Plan(action); + this.engine.Plan(action, plannedScope); } /// @@ -327,16 +325,16 @@ namespace WixToolset.BootstrapperApplicationApi /// public int SendEmbeddedError(int errorCode, string message, int uiHint) { - int result = 0; - this.engine.SendEmbeddedError(errorCode, message, uiHint, out result); + this.engine.SendEmbeddedError(errorCode, message, uiHint, out var result); + return result; } /// public int SendEmbeddedProgress(int progressPercentage, int overallPercentage) { - int result = 0; - this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out result); + this.engine.SendEmbeddedProgress(progressPercentage, overallPercentage, out var result); + return result; } diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs index a1f8bfe0..7a5a4cfd 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperCommand.cs @@ -19,6 +19,11 @@ namespace WixToolset.BootstrapperApplicationApi /// Display Display { get; } + /// + /// Gets the bundle scope if set at the command line. + /// + BundleScope Scope { get; } + /// /// Gets the command line arguments. /// diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs index 13702757..9df57cd3 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IBootstrapperEngine.cs @@ -178,10 +178,11 @@ namespace WixToolset.BootstrapperApplicationApi ); /// - /// See . + /// See . /// void Plan( - [MarshalAs(UnmanagedType.U4)] LaunchAction action + [MarshalAs(UnmanagedType.U4)] LaunchAction action, + [MarshalAs(UnmanagedType.U4)] BundleScope plannedScope ); /// @@ -343,6 +344,28 @@ namespace WixToolset.BootstrapperApplicationApi UpdateReplaceEmbedded, } + /// + /// The scope of the bundle when the chain contains per-user-or-machine or per-machone-or-user packages. + /// + public enum BundleScope + { + /// + /// Let Burn choose the scope. Per-user-or-machine packages will be + /// planned as per-machine packages. + /// + Default, + + /// + /// Set per-machine scope for per-user-or-machine packages. + /// + PerMachine, + + /// + /// Set per-user scope for per-user-or-machine packages. + /// + PerUser, + } + /// /// The message log level. /// diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs index 03ceed06..a763d741 100644 --- a/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/IEngine.cs @@ -139,7 +139,8 @@ namespace WixToolset.BootstrapperApplicationApi /// Determine the installation sequencing and costing. /// /// The action to perform when planning. - void Plan(LaunchAction action); + /// The bundle scope for per-user-or-machine packages. + void Plan(LaunchAction action, BundleScope plannedScope); /// /// Set the update information for a bundle. -- cgit v1.2.3-55-g6feb