Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit ae1400b

Browse files
committed
Document out-of-proc BA changes in WiX v5
1 parent e8d2a1c commit ae1400b

File tree

3 files changed

+120
-5
lines changed

3 files changed

+120
-5
lines changed
Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,93 @@
11
# Out-of-process bootstrapper applications in WiX v5
22

3-
:::info
4-
TODO: WiX v5 documentation is under development.
3+
In WiX v5, bootstrapper applications are separate processes and no longer hosted by the Burn process. The motivation for this change can be found in [#7916](https://github.com/wixtoolset/issues/issues/7916). This is obviously a significant breaking change so it was also taken as an opportunity to improve several .nupkg package names as described in [#8020](https://github.com/wixtoolset/issues/issues/8020).
4+
5+
If using the WiX Standard Bootstrapper Application or WiX Internal UI Bootstrapper Application, the move to out-of-process bootstrapper applications is abstracted away and should not introduce any breaking changes. The rest of this document details changes required to custom bootstrapper applications.
6+
7+
First, the custom bootstrapper application project needs to change from DLL to EXE.
8+
9+
```diff
10+
exampleba.vcxproj
11+
- <ConfigurationType>DynamicLibrary</ConfigurationType>
12+
+ <ConfigurationType>Application</ConfigurationType>
13+
```
14+
15+
or
16+
17+
```diff
18+
exampleba.csproj
19+
+ <OutputType>WinExe</OutputType>
20+
```
21+
22+
and reference the `WixToolset.BootstrapperApplicationApi` NuGet package (this one package replaces both the `WixToolset.BalUtil` and `WixToolset.Mba.Core` packages).
23+
24+
As an executable, the boostrapper application needs a `main` function. Bootstrapper application main functions should be minimal to connect to the parent burn process as quickly as possible. For example,
25+
26+
```cpp
27+
// exampleba.cpp
28+
EXTERN_C int WINAPI wWinMain(
29+
__in HINSTANCE hInstance,
30+
__in_opt HINSTANCE /* hPrevInstance */,
31+
__in_z_opt LPWSTR /*lpCmdLine*/,
32+
__in int /*nCmdShow*/
33+
)
34+
{
35+
HRESULT hr = S_OK;
36+
IBootstrapperApplication* pApplication = new ExampleBootstrapperApplication();
37+
38+
hr = BootstrapperApplicationRun(pApplication);
39+
ExitOnFailure(hr, "Failed to run bootstrapper application.");
40+
41+
LExit:
42+
ReleaseObject(pApplication);
43+
44+
return 0;
45+
}
46+
```
47+
48+
or
49+
50+
```cs
51+
// example.cs
52+
using WixToolset.BootstrapperApplicationApi;
53+
54+
internal class Program
55+
{
56+
private static int Main()
57+
{
58+
var application = new ExampleBoostrapperApplication();
59+
60+
ManagedBootstrapperApplication.Run(application);
61+
62+
return 0;
63+
}
64+
}
65+
```
66+
67+
Notice that the bootstrapper engine and command objects are no longer passed to the creation of the bootstrapper application. Those values are not available until the application has been connected to the parent burn process in `Run()`. Therefore, there is a new `OnCreate()` bootstrapper application callback that provides both the bootstrapper engine and command objects. To keep the API balanced an `OnDestroy()` callback was also added.
68+
69+
At this point, the bootstrapper application API is fairly compatible with only a few additional details to keep in mind.
70+
71+
* Managed BootstrapperApplications no longer support changing "run async". BA's now always run their UI in a separate thread.
72+
* `BootstrapperApplicationFactory` concept no longer used. Remove all classes related to it. Create the BootstrapperApplication in the `main` function as shown above.
73+
* `BalBaseBootstrapperApplication.h` renamed `BootstrapperApplicationBase.h`.
74+
* `CBalBaseBootstrapperApplication` deprecated, use `CBootstrapperApplicationBase` instead.
75+
76+
To take advantage of the breaking change, we took the opportunity to improve the names of many NuGet packages related to custom bootstrapper applications:
77+
78+
* `WixToolset.BalUtil` - renamed to `WixToolset.BootstrapperApplicationApi` to provide the native headers and libraries to communicate Burn. Also, split out the `WixToolset.WixStandardBootstrapperApplicationFunctionApi` for WiX Standard Bootstrapper Application functions API.
79+
* `WixToolset.Mba.Core` - merged the managed headers into the `WixToolset.BootstrapperApplicationApi` so there is a single package for custom bootstrapper applications.
80+
* `WixToolset.BextUtil` - renamed to `WixToolset.BootstrapperExtensionApi`.
81+
* `WixToolset.Bal.wixext` - renamed to `WixToolset.BootstrapperApplications.wixext` but also kept` WixToolset.Bal.wixext` for backwards compatibility.
82+
* `WixToolset.Dnc.HostGenerator` - no longer relevant in WiX v5 and not available.
83+
84+
85+
:::tip
86+
Set a **SYSTEM** environment variable named `WixDebugBootstrapperApplications` to `true` to get a prompt to debug all boostrapper applications. Set a **SYSTEM** environment variable named `WixDebugBootstrapperApplication` to the file name of the bootstrapper application executable to get a prompt to debug that bootstrapper application.
587
:::
688

89+
90+
Related issues
91+
92+
* [#7916 - BootstrapperApplication Processes](https://github.com/wixtoolset/issues/issues/7916)
93+
* [#8020 - Better Burn-related .nupkg names](https://github.com/wixtoolset/issues/issues/8020)

src/Docusaurus/docs/tools/burn/builtin-variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ The Burn engine offers a set of commonly-used variables so you can use them with
7272
| WixBundleManufacturer | The manufacturer of the bundle (from `Bundle/@Manufacturer`). |
7373
| WixBundleOriginalSource | The source path where the bundle originally ran. |
7474
| WixBundleOriginalSourceFolder | The folder where the bundle originally ran. |
75-
| WixBundleSourceProcessPath | The source path of the bundle where originally executed. Will only be set when bundle is executing in the clean room. |
76-
| WixBundleSourceProcessFolder | The source folder of the bundle where originally executed. Will only be set when bundle is executing in the clean room. |
75+
| WixBundleSourceProcessPath | The source path of the bundle where originally executed. Will only be set when bundle is executing in the clean room. (Removed in WiX v5) |
76+
| WixBundleSourceProcessFolder | The source folder of the bundle where originally executed. Will only be set when bundle is executing in the clean room. (Removed in WiX v5) |
7777
| WixBundleProviderKey | The bundle dependency provider key. |
7878
| WixBundleTag | The developer-defined tag string for this bundle (from `Bundle/@Tag`). |
7979
| WixBundleUILevel | The level of the user interface (the BOOTSTRAPPER_DISPLAY enum). |

src/Docusaurus/docs/tools/burn/index.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Here's how you might add a built-in BA to a bundle:
106106
</BootstrapperApplication>
107107
```
108108

109-
You can also create an entirely custom bootstrapper application, either in native code or managed code. Here's how you might reference a custom native-code BA:
109+
You can also create an entirely custom bootstrapper application, either in native code or managed code. Here's how you might reference a custom native-code BA in WiX v4:
110110

111111
```xml
112112
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
@@ -120,6 +120,17 @@ You can also create an entirely custom bootstrapper application, either in nativ
120120
</BootstrapperApplication>
121121
```
122122

123+
...or in WiX v5:
124+
125+
```xml
126+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
127+
<Bundle>
128+
<BootstrapperApplication SourceFile="bobstdba.exe">
129+
<PayloadGroupRef
130+
Id="MyStandardBootstrapperApplicationPayloads" />
131+
</BootstrapperApplication>
132+
```
133+
123134
Here's how you might reference a custom managed-code BA written in .NET 6:
124135

125136
```xml
@@ -138,3 +149,20 @@ Here's how you might reference a custom managed-code BA written in .NET 6:
138149
<bal:WixDotNetCoreBootstrapperApplicationHost />
139150
</BootstrapperApplication>
140151
```
152+
153+
...or in WiX v5:
154+
155+
```xml
156+
<Wix
157+
xmlns="http://wixtoolset.org/schemas/v4/wxs"
158+
xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
159+
160+
<Bundle>
161+
<BootstrapperApplication SourceFile="MyBA.EarliestCoreMBA.exe">
162+
<Payload SourceFile="MyBA.EarliestCoreMBA.deps.json" />
163+
<Payload SourceFile="MyBA.EarliestCoreMBA.dll" />
164+
<Payload SourceFile="MyBA.EarliestCoreMBA.runtimeconfig.json" />
165+
<Payload SourceFile="mbanative.dll" />
166+
<Payload SourceFile="WixToolset.Mba.Core.dll" />
167+
</BootstrapperApplication>
168+
```

0 commit comments

Comments
 (0)