Skip to content

[WiX 5] Migrate workloads - #5265

Merged
joeloff merged 45 commits into
dotnet:mainfrom
joeloff:workloads-wix5
Jun 24, 2026
Merged

joeloff merged 45 commits into
dotnet:mainfrom
joeloff:workloads-wix5

Conversation

@joeloff

@joeloff joeloff commented Mar 6, 2026 •

Copy link
Copy Markdown
Member

Overview

This PR updates the various tasks used for generating workload MSIs, migrating from WiX v3 to v5. While publicly very little has changed, the internal organization is a near complete redesign and will make it easier to adapt to future changes in WiX.

MSI Source Templates

The previous implementation carried multiple source templates to build different installers for manifests, various workload pack types, pack groups and workload sets. The templates relied on a combination of extensive preprocessor logic and in a few cases, rewriting the XML from the existing templates, rendering the templates almost obsolete. The preprocessor directives also complicate generating wixpack archives needed for signing in v5.

The new implementation uses a single WiX source template, allowing derived classes to manipulate the source programmatically and follow a compositional pattern. The implementation is primarily confined to the WixDocument and various extension methods. Specialized classes used to generate specific workload MSIs can easily modify elements in the source.

The new workflow is as follows

  • The MsiBase class is responsible for extracting the default source template, Product.wxs.
  • Common values like the ProductCode or ProductVersion are replaced in source at extraction time using a dictionary that specialized classes can override.
  • Specialized classes can modify the authoring using a single set of APIs to ensure consistency.
  • The base class provides all the logic to build (compile and link) the MSI using the new WiX CLI.

Test Coverage

  • Previous implementations had no test coverage for workload pack groups.
  • Existing tests have been expanded to ensure deeper coverage over the generated MSIs including items like the Registry table (to verify provider and install record keys), additional File table checks to ensure specific content is present, etc.

Compilation/Linking

  • SDK style .wixproj projects are not used because they require NuGet restore to run. Because the projects are generated inside a running build (after restore executed), it would require running nested restore operations for each project. Additionally, these projects all use the same set of packages so builds would incur unnecessary overhead across a large set of projects (1 per MSI).
  • ICE suppressions have been removed. While ICE validation triggers when using SDK style projects, it does not run when building using the CLI.
  • Tests have been updated to build the generated SWIX project and verify the manifest. This is mostly to catch breaking changes in WiX when the SWIX toolset is lagging.

Other templates

Besides generating MSIs for workloads, the underlying tasks also need to generate the corresponding SWIX authoring for Visual Studio and NuGet packages for the MSI payloads. All of these actions require specific projects. The class hierarchy has been modified to ensure that common features around the various templates can be properly shared.

classDiagram
     class WorkloadTemplateBase {
         <<abstract>>
         +string OutputPath
         #Dictionary~string, string~ ReplacementTokens
         #IEnumerable~string~ Files
         #string TemplateOutputPath
         #string SourcePath
         #string IntermediateOutputPath
         +Build() void
         +Create() string
         +AddFile(templateFilename, replaceTokens) string
         +AddFile(templateFilename, destinationFilename, replaceTokens) string
         +AddSourceFile(path) void
     }

     class MsiBase {
         <<abstract>>
     }

     class MsiPayloadPackageProject

     class SwixProjectBase {
         <<abstract>>
     }

     class WorkloadManifestMsi
     class WorkloadPackGroupMsi
     class WorkloadPackMsi
     class WorkloadSetMsi

     class ComponentSwixProject
     class MsiSwixProject
     class PackageGroupSwixProject

     WorkloadTemplateBase <|-- MsiBase
     WorkloadTemplateBase <|-- MsiPayloadPackageProject
     WorkloadTemplateBase <|-- SwixProjectBase

     MsiBase <|-- WorkloadManifestMsi
     MsiBase <|-- WorkloadPackGroupMsi
     MsiBase <|-- WorkloadPackMsi
     MsiBase <|-- WorkloadSetMsi

     SwixProjectBase <|-- ComponentSwixProject
     SwixProjectBase <|-- MsiSwixProject
     SwixProjectBase <|-- PackageGroupSwixProject
     
Loading

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team March 6, 2026 00:22
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team June 3, 2026 22:18
@joeloff

joeloff commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

I have an unofficial VMR build that's green for the verticals.

I'm going to remove the runtime copy of the workloads project next.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team June 18, 2026 17:05
@joeloff

joeloff commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

I have a successful, fully signed build. Verified random nupkgs for the MSIs and the MSIs themselves

image image

@NikolaMilosavljevic NikolaMilosavljevic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of design/maintainability items on the new WixDocument API (inline). Both are non-blocking but worth addressing since WixDocument is the central authoring surface of this redesign.

@joeloff
joeloff merged commit 41b5d54 into dotnet:main Jun 24, 2026
11 checks passed
rmarinho added a commit to dotnet/maui that referenced this pull request Jul 2, 2026
- docs/design/WorkloadMsi.md: Full architecture docs covering WiX 6
  migration, validation criteria, package management, troubleshooting
- .github/instructions/workload-msi.instructions.md: Copilot guidance
  for working with src/Workload/ files

Documents lessons learned from the WiX 3→6 migration including:
- NU1212 fix (netstandard2.0 + ExcludeAssets)
- Arcade version requirements (26330.112+)
- Extension path pattern (wixext6 subfolder)
- SWIX build considerations
- Validation criteria (Wix4DependencyProvider table, msi.json, VSDrop)
- Comparison with dotnet/dotnet#5265 arcade-level rewrite

Co-authored-by: Copilot App <[email protected]>
rmarinho added a commit to dotnet/maui that referenced this pull request Jul 7, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Migrate workload MSI generation from WiX 3 (candle/light via
`Microsoft.Signed.WiX`) to WiX 6 (wix.exe via `Microsoft.Wix` +
extension packages).

Follows the pattern established in dotnet/android#11743 and the
yaml-templates `convert-v5/convert.proj` reference implementation.

## Related PRs

- dotnet/android#11743 — Android WiX 6 migration (reference
implementation)
- dotnet/dotnet#5265 — Arcade-level WiX 5/6 rewrite (deeper refactor of
`CreateVisualStudioWorkload` task internals)

## Changes

### `src/Workload/workloads.csproj`
- Target framework changed to `netstandard2.0` (avoids NU1212 —
`Microsoft.Wix` is a DotnetTool package type)
- Added `GenerateDependencyFile=false`
- Replaced `Microsoft.Signed.WiX` with WiX 6 packages (`Microsoft.Wix`,
`Microsoft.WixToolset.Heat`, and 3 wixext packages)
- `ExcludeAssets="all"` on `Microsoft.Wix` (required for DotnetTool
package type)
- Added `WixExe`, `HeatExe` properties and `WixExtensions` items  
- Updated `CreateVisualStudioWorkload` task invocation: `WixToolsetPath`
→ `WixExe`/`HeatExe`/`WixExtensions`
- Removed `UseWorkloadPackGroupsForVS` (no longer supported in arcade
11.x)

### `eng/Versions.props`
- Bumped arcade task packages to `11.0.0-beta.26330.112` (required for
WiX 6 task parameters)
- Added `MicrosoftWixVersion` = `6.0.3-dotnet.4`

### `eng/NuGetVersions.targets`
- Replaced `Microsoft.Signed.WiX` version pin with 5 WiX 6 package pins

### `eng/pipelines/common/sdk-insertion.yml`
- Removed outdated `v4.yml` comment

## Validation

✅ **Internal CI build
[#3013410](https://dev.azure.com/dnceng/internal/_build/results?buildId=3013410)
— PASSED**

### Artifact validation (matches dotnet/android#11743 acceptance
criteria):

1. **MSI table rename** ✅ — Built with `WiX Dev Build (6.0.3.4)`, uses
`Wix4DependencyProvider` table
2. **msi.json in MSI nupkg** ✅ — `ProviderKeyName` correctly populated
(e.g., `"Microsoft.Maui.Core,11.0.0-preview.7.26352.12,x64"`)
3. **RelatedProducts** ✅ — `WIX_UPGRADE_DETECTED` /
`WIX_DOWNGRADE_DETECTED` entries present (WiX 6 feature gain)
4. **VSDrop SWIX JSON** ✅ — All 3 VSDrop zips produced (components,
components-pre, packs), vsman files correctly reference MSI packages
with proper providerKey and install sizes

## Comparison with dotnet/dotnet#5265 (Arcade-level Rewrite)

The arcade PR (dotnet/dotnet#5265) performs a deeper refactor of the WiX
infrastructure. Here is how our approach compares:

| Aspect | MAUI (this PR) | SDK (dotnet/dotnet#5265) | Status |
|--------|----------------|--------------------------|--------|
| WiX packages | ✅ Same 5 packages | Same | Aligned |
| `WixExe`/`HeatExe`/`WixExtensions` | ✅ Correct | Same | Aligned |
| Arcade version | 26330.112 | Same+ | Aligned |
| SwixBuild package | `.Dotnet` 1.1.87 | Full variant 1.1.922 + desktop
MSBuild | **Diverges** — works today |
| SWIX build method | `<MSBuild>` task | `<Exec>` with desktop
`msbuild.exe` | **Diverges** — works today |
| `CreateWixPacks` | Not explicitly set (defaults to true) | Explicitly
set | Functionally equivalent |
| `LightCommandPackageDrop` | Never had it | Removed | N/A |

### Future considerations

1. **SwixBuild.Dotnet deprecation**: If
`MicroBuild.Plugins.SwixBuild.Dotnet` is deprecated, we will need to
switch to the full
`Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild` + desktop
MSBuild pattern (using `vswhere` to locate VS).
2. **Arcade dependency flow**: When the arcade version from
dotnet/dotnet#5265 ships, improvements to `CreateVisualStudioWorkload`
will flow to us automatically — no code changes needed in MAUI unless
the task API changes.

---------

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rmarinho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants