-
Notifications
You must be signed in to change notification settings - Fork 0
Fix RuntimeIdentifier being passed to class libraries during WinUI app publish #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. --> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <!-- | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Code Quality - Documentation & StructureExceptional documentation quality: ✅ Comprehensive header comment explains:
✅ Professional structure:
✅ Maintainability: Future developers will easily understand the purpose and approach without needing to research the original issue. |
||
| Fix for issue where RuntimeIdentifier should not be used when determining outputs of referenced class libraries during publish. | ||
|
|
||
| The problem occurs when publishing a WinUI app with a RuntimeIdentifier specified - the RID gets incorrectly passed | ||
| to class library projects when MSBuild is determining their outputs. Class libraries should not consider the RID | ||
| since they are platform-agnostic. | ||
|
|
||
| This fix uses MSBuild's built-in ProjectReferenceGlobalPropertiesToRemove mechanism to prevent RuntimeIdentifier | ||
| from being passed to referenced projects during publish operations only. | ||
| --> | ||
|
|
||
| <PropertyGroup Condition="'$(RuntimeIdentifier)' != '' and ('$(IsPublishing)' == 'true' or '$(DeployOnBuild)' == 'true' or '$(PublishProfile)' != '')"> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Logic Correctness - Publish Condition AnalysisStrong Logic Implementation: The condition logic is well-designed and comprehensive: Condition="'$(RuntimeIdentifier)' != '' and ('$(IsPublishing)' == 'true' or '$(DeployOnBuild)' == 'true' or '$(PublishProfile)' != '')"✅ Correctly detects publish scenarios:
✅ Only activates when RID is set: Prevents unnecessary processing when no RuntimeIdentifier is specified. 💡 Recommendation: Consider adding a property to allow users to opt-out if needed: |
||
| <!-- | ||
| During publish operations, ensure RuntimeIdentifier is not passed to referenced class library projects. | ||
| This prevents the RID from affecting class library output path resolution during publish. | ||
| --> | ||
| <ProjectReferenceGlobalPropertiesToRemove Condition="'$(ProjectReferenceGlobalPropertiesToRemove)' == ''">RuntimeIdentifier</ProjectReferenceGlobalPropertiesToRemove> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Code Quality - Property Handling LogicExcellent defensive programming. The two-condition approach properly handles both scenarios: Scenario 1 - Empty property: Condition="'$(ProjectReferenceGlobalPropertiesToRemove)' == ''"Sets the entire property to just Scenario 2 - Existing property: Condition="... and !$(ProjectReferenceGlobalPropertiesToRemove.Contains('RuntimeIdentifier'))"Appends ✅ Prevents duplicate entries - The |
||
| <ProjectReferenceGlobalPropertiesToRemove Condition="'$(ProjectReferenceGlobalPropertiesToRemove)' != '' and !$(ProjectReferenceGlobalPropertiesToRemove.Contains('RuntimeIdentifier'))">$(ProjectReferenceGlobalPropertiesToRemove);RuntimeIdentifier</ProjectReferenceGlobalPropertiesToRemove> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Code Quality - Integration & Documentation
Clean integration approach:
✅ Proper placement: Added in the right location within the target file structure
✅ Self-documenting: The comment clearly explains what this import addresses
✅ Consistent style: Matches the existing import pattern in the file
Minor suggestion: Consider adding the issue number to the comment for traceability:
<!-- Fix for RuntimeIdentifier issue during publish of class libraries (Issue #13) -->