Bug: CppWinRTCopyWinMDToOutputDirectory: Outputs mismatch when merged WinMD name differs from RootNamespace
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- build-system
Research direction
Locate the build target that defines CppWinRTCopyWinMDToOutputDirectory and inspect its Inputs, Outputs, Copy destination, and FileWrites metadata. Align the declared output and FileWrites entries with the copied merged WinMD filename, then verify that repeated builds and downstream packaging no longer rebuild unnecessarily.
Written by the indexing model from the issue text.
Description
Version
2.0.220131.2
Summary
Problem
The CppWinRTCopyWinMDToOutputDirectory target has mismatched Inputs/Outputs:
- Inputs:
@(_MdMergedOutput)— the merged WinMD (e.g.Contoso.Core.winmd) - Outputs:
$(CppWinRTProjectWinMD)— resolves to$(OutDir)$(RootNamespace).winmd(e.g.Contoso.App.winmd) - Copy DestinationFiles:
@(_MdMergedOutput->'$(OutDir)%(Filename)%(Extension)')— writes the correct file
When the merged WinMD filename differs from $(RootNamespace), the declared Output never matches the actual file written. MSBuild always considers the target out-of-date, causing cascading rebuilds in all downstream projects (.xbf copies, PRI regen, MSIX packaging, C# recompiles via CsWinRT).
This happens when a project's IDL files use a different root namespace than the project's RootNamespace property (e.g. IDL uses Contoso.Core but the project's RootNamespace is Contoso.App).
Fix
Change Outputs to a 1:1 transform matching the Copy task:
Outputs="@(_MdMergedOutput->'$(OutDir)%(Filename)%(Extension)')"
Also update FileWrites to match
Reproducible example
Expected behavior
No response
Actual behavior
No response
Additional comments
No response
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 281
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/cppwinrt
-
Difficulty 1/5 Under an hour Newbie friendliness 20/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
All issues in microsoft/cppwinrt
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
infiniflow/infinity#3502 ·