Fix CsWinRTAuthoringWinUI.sln build ordering for C++ consumers#644
Open
qiutongMS wants to merge 1 commit into
Open
Fix CsWinRTAuthoringWinUI.sln build ordering for C++ consumers#644qiutongMS wants to merge 1 commit into
qiutongMS wants to merge 1 commit into
Conversation
…g sample The three consumer apps in CsWinRTAuthoringWinUI.sln (CppApp, CppAppUnpackaged, CsApp) all load the WinUIComponentCs.dll at runtime, but only CsApp can express that through a managed <ProjectReference>; the two C++ projects cannot ProjectReference a C# project. Without an explicit dependency, MSBuild may build the consumers in parallel with the component and copy stale or missing binaries, producing intermittent build failures. Add a sln-level GlobalSection(ProjectDependencies) so all three consumers wait for WinUIComponentCs to finish before they build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes intermittent build-order races in the CsWinRTAuthoringWinUI sample solution by adding explicit solution-level project dependencies so the C++ consumer projects build after WinUIComponentCs, ensuring the projected winrt/WinUIComponentCs.h (and related build outputs) exist before C++ compilation.
Changes:
- Adds a
GlobalSection(ProjectDependencies) = postSolutionblock to enforce build ordering. - Declares
CppApp,CppAppUnpackaged, andCsAppas depending onWinUIComponentCsat the solution level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds an explicit sln-level GlobalSection(ProjectDependencies) = postSolution so that
CppApp,CppAppUnpackaged, andCsAppare built afterWinUIComponentCs.The C# projects
CsAppandWinUIComponentCsalready share a project reference, so MSBuild orders them correctly. However the two C++ projects consumeWinUIComponentCsvia the projected C++/WinRT headerwinrt/WinUIComponentCs.hand the runtime.dll— they cannot use a managed<ProjectReference>. Without the sln-level declaration, MSBuild has no ordering signal and can race the C++ compile against the still-missing header/winmd fromWinUIComponentCs, producing intermittentC1083: Cannot open include file 'winrt/WinUIComponentCs.h'failures.Reproduced locally: reverting just the sln block resurrects the
C1083error on a clean build; with the block, the C# half (CsApp) builds and runs cleanly and dependency ordering is correct end-to-end.This is a build-correctness fix only — no source code, no API surface, no scenario behavior changes.
Target Release
N/A — sln/build fix.
Checklist
winapp runend-to-end).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com