Skip to content

Preserve overrides with export and import#6118

Open
Trenly wants to merge 5 commits intomicrosoft:masterfrom
Trenly:PreserveOverrides
Open

Preserve overrides with export and import#6118
Trenly wants to merge 5 commits intomicrosoft:masterfrom
Trenly:PreserveOverrides

Conversation

@Trenly
Copy link
Copy Markdown
Contributor

@Trenly Trenly commented Mar 30, 2026

Summary

When a package is installed with --override or --custom arguments, those values are now preserved through the winget export / winget import roundtrip, allowing packages to be reinstalled with the same
customizations automatically.

Changes

Export (winget export)

  • The installed package metadata is queried for previously stored UserOverrideArguments and UserCustomSwitches values and written into the export file under the new OverrideArguments and CustomSwitches
    fields per package entry.
  • The packages schema v2.0 has been updated to define both new optional fields.

Import (winget import)

  • When processing packages from an import file, OverrideArguments and CustomSwitches are now forwarded as --override and --custom args respectively into each package's install sub-context.
  • Both fields are fully independent and optional — packages without them are unaffected.

Install metadata persistence

  • --override and --custom values supplied at install time are now stored in the package's installed metadata (UserOverrideArguments / UserCustomSwitches), making them available for future export
    operations and upgrade flows.

Tests

  • PackageCollection unit tests covering serialization and deserialization of OverrideArguments and CustomSwitches in both the v2.0 schema parser and JSON writer, including cases where either, both, or
    neither field is present.
  • ExportFlow unit tests verifying that installed packages with stored override/custom metadata produce the correct fields in the export file.
  • CompositeSource unit tests covering propagation of UserOverrideArguments and UserCustomSwitches metadata.
  • ImportFlow unit tests (ImportFlow_WithOverrideArgs, ImportFlow_WithCustomSwitches) verifying that each field is independently applied during install — override args replace all installer arguments while
    custom switches are appended alongside the defaults.

Microsoft Reviewers: Open in CodeFlow

@Trenly Trenly requested a review from a team as a code owner March 30, 2026 18:33
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.

1 participant