Fix UWP XBF files losing subdirectory paths in resources.pri when UseArtifactsOutput is enabled - #53867
Conversation
|
@copilot can you add a test for this? |
There was a problem hiding this comment.
Pull request overview
Fixes incorrect resource path computation for UWP-generated XBF files when UseArtifactsOutput=true moves IntermediateOutputPath outside the project directory, preventing subdirectory paths from being dropped in resources.pri.
Changes:
- Adds a new MSBuild target (
_FixGeneratedXbfFilesLink) that runs afterMarkupCompilePass2forUseUwp=true. - For
_GeneratedXbfFilesoutside the project directory, setsLinkto the path relative to$(IntermediateOutputPath)to preserve subdirectory structure.
Added a regression test in commit c51802b: The test creates a |
c51802b to
6382692
Compare
0d45159 to
19177e5
Compare
|
@copilot test ItSetsCorrectLinkMetadataOnGeneratedXbfFilesWhenUsingArtifactsOutput is failing because of this change. Please fix: |
Fixed in the latest commit. The MSB4096 was caused by using unqualified |
|
Due to lack of recent activity, this PR has been labeled as 'Stale'. It will be closed if no further activity occurs within 7 more days. Any new comment will remove the label. |
…ArtifactsOutput is enabled Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/4d3dd462-6363-4288-8aca-ceaf03eb3e26 Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
… PropertyGroup Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/4d3dd462-6363-4288-8aca-ceaf03eb3e26 Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
…tput is enabled Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/89b95d8b-f70d-4b67-9b72-de499eb167cc Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
… condition Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
7f73d14 to
a3b40cb
Compare
baronfel
left a comment
There was a problem hiding this comment.
Agree with Marc - this looks solid.
…f xUnit [WindowsOnlyFact] The test project uses MSTest, not xUnit. Replace the non-existent WindowsOnlyFactAttribute with the correct MSTest equivalent that all other Windows-only tests in this file use. Fixes CS0246 build error in CI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 65d4a706-84ae-4b55-82d0-d700601b113f
When
UseUwp=trueandUseArtifactsOutput=true, theIntermediateOutputPathmoves outside the project directory. The AppX Package Targets compute PRI paths for_GeneratedXbfFilesusing%(Filename)%(Extension)for items outside the project directory, dropping subdirectory prefixes (e.g.,Styles.xbfinstead ofResources\Styles.xbf), causing runtimeXamlParseException.Changes
Microsoft.NET.Windows.targets: Adds_FixGeneratedXbfFilesLinktarget that runsAfterTargets="MarkupCompilePass2"whenUseUwp=true. For any_GeneratedXbfFilesitem outside the project directory (the artifacts case), setsLinkto the path relative to$(IntermediateOutputPath):This ensures
Resources\Styles.xbfis correctly emitted intoresources.prirather than justStyles.xbf, matching what the XAML compiler-generated code-behind references viams-appx:///Resources/Styles.xaml.GivenThatWeWantToBuildAWindowsDesktopProject.cs: Adds regression testItSetsCorrectLinkMetadataOnGeneratedXbfFilesWhenUsingArtifactsOutputthat creates a UWP project withUseArtifactsOutput=true, injects simulated_GeneratedXbfFilesitems in subdirectories of$(IntermediateOutputPath), and verifies that the_FixGeneratedXbfFilesLinktarget correctly setsLinkmetadata to preserve the subdirectory structure (e.g.,Resources\Styles.xbfandViews\Home.xbf).