Skip to content

Conversation

@Arlodotexe
Copy link
Member

Summary

Fixes the Ribbon control not publishing to NuGet feeds by correcting the evaluation order of PackageId and the Import statement 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 PackageId was being evaluated before importing the props file that defines $(PackageIdVariant), resulting in malformed package identifiers like CommunityToolkit..Controls.Ribbon (note the double dot from the empty variable).

Root Cause

In Ribbon.csproj, the PackageId PropertyGroup appeared before the Import statement:

<PropertyGroup>
  <PackageId>$(PackageIdPrefix).$(PackageIdVariant).Controls.$(ToolkitComponentName)</PackageId>
</PropertyGroup>

<Import Project="$(ToolingDirectory)\ToolkitComponent.SourceProject.props" />

Since MSBuild evaluates properties in document order, $(PackageIdVariant) was undefined when PackageId was evaluated. The variable is only defined after importing ToolkitComponent.SourceProject.props (via the chain: ToolkitComponent.SourceProject.props → Library.props → WinUI.TargetVersion.props).

Solution

Move the Import statement to appear before the PackageId PropertyGroup:

<Import Project="$(ToolingDirectory)\ToolkitComponent.SourceProject.props" />

<PropertyGroup>
  <PackageId>$(PackageIdPrefix).$(PackageIdVariant).Controls.$(ToolkitComponentName)</PackageId>
</PropertyGroup>

This ensures $(PackageIdVariant) is defined when PackageId is evaluated.

Validation

This fix aligns Ribbon with the established pattern used by all other controls:

Control Experiment

Notably, PR #719 (commit 4e42800) added PackageId to both Ribbon and OpacityMaskView in the same commit:

  • OpacityMaskView: Import added first, then PackageId → ✅ Works (published successfully)
  • Ribbon: PackageId added before existing Import → ❌ Failed (never published)

This demonstrates that placement order is the causative factor.

Testing

  • Verified all other controls follow consistent Import → PackageId pattern
  • CI weekly release will validate .nupkg generation and publication

Impact

  • Low risk: 3-line change, no logic modifications
  • Aligns with established pattern across all other controls
  • Fixes missing Ribbon packages in NuGet feeds

Move Import statement before PackageId PropertyGroup to ensure
$(PackageIdVariant) is defined when PackageId is evaluated.

Previously, PackageId referenced $(PackageIdVariant) before the
Import that defines it, resulting in malformed package identifiers
like 'CommunityToolkit..Controls.Ribbon' (with empty variable).

This prevented Ribbon packages from being published to NuGet feeds.

All other controls have Import before PackageId and work correctly.
This aligns Ribbon with the established pattern.

Fixes #739
@Arlodotexe Arlodotexe enabled auto-merge October 8, 2025 05:51
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Thanks Arlo!

@Arlodotexe Arlodotexe merged commit 6282a26 into main Oct 8, 2025
24 checks passed
@Arlodotexe Arlodotexe deleted the ci/fix-ribbon-packageid-import-order branch October 9, 2025 00:45
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.

Ribbon control in unavailable

2 participants