Fix Ribbon control PackageId evaluation order #749
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Ribbon control not publishing to NuGet feeds by correcting the evaluation order of
PackageIdand theImportstatement in Ribbon.csproj.Fixes #739
Problem
The Ribbon control has been missing from all NuGet artifact sets (WinUI 0, 2, and 3) in weekly CI releases. Investigation revealed that
PackageIdwas being evaluated before importing the props file that defines$(PackageIdVariant), resulting in malformed package identifiers likeCommunityToolkit..Controls.Ribbon(note the double dot from the empty variable).Root Cause
In
Ribbon.csproj, thePackageIdPropertyGroup appeared before the Import statement:Since MSBuild evaluates properties in document order,
$(PackageIdVariant)was undefined whenPackageIdwas evaluated. The variable is only defined after importingToolkitComponent.SourceProject.props(via the chain: ToolkitComponent.SourceProject.props → Library.props → WinUI.TargetVersion.props).Solution
Move the Import statement to appear before the PackageId PropertyGroup:
This ensures
$(PackageIdVariant)is defined whenPackageIdis evaluated.Validation
This fix aligns Ribbon with the established pattern used by all other controls:
Control Experiment
Notably, PR #719 (commit 4e42800) added
PackageIdto both Ribbon and OpacityMaskView in the same commit:This demonstrates that placement order is the causative factor.
Testing
Impact