Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
I think this is a reasonable fix. Eventually there might be pick which ever copy that's newer, but I don't see a need for that right now. Another thing that's not mentioned in this PR so I'd like to point out is, with existing behavior, we'd end up using SDK's targets (imported later, overrides already imported ones from CDK) with CDK's task implementation (since our |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
7266093 to
5620c74
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Rebased-head CI and Windows/Linux validation remain outstanding for this shared SDK import change.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves host-injected ProjectData writers while retaining the SDK’s bundled writer for standalone builds.
Changes:
- Guards the bundled import when
_ProjectDataTaskAssemblyis already set. - Adds host-precedence regressions for single-target, multi-target outer, and inner evaluations.
- Documents writer precedence.
| File | Description |
|---|---|
test/TestAssets/TestProjects/ProjectDataHostTargets/HostProjectData.targets |
Supplies a host-writer test fixture. |
test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseProjectData.cs |
Tests host precedence across three evaluation shapes. |
src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets |
Conditionally imports the bundled writer. |
.github/memory/ARCHITECTURE.md |
Documents host and SDK writer selection. |
|
Closing in favor of #56522, which carries the same complete production fix and regression tests on release/11.0.1xx. The release change is intended to flow back to main through the normal inter-branch merge flow. |
Summary
Why
The SDK imports its bundled ProjectData targets after the common-targets hooks used by IDE hosts. That replaces an already-injected writer with the SDK's copy. With .NET 11 RC2 and C# Dev Kit, this drops generated assembly platform attributes and iOS/MacCatalyst project slices, producing false-positive CA1416 warnings and missing platforms.
The unconditional SDK-bundled ProjectData import was introduced by #56243, merged on September 18, 2026. This is a likely source of the RC2 recurrence because the later import can replace the host writer. The original August 24 CA1416 report predates that change, so this attribution concerns the writer-precedence regression and recurrence rather than the original issue.
Addresses the RC2 recurrence investigated from microsoft/vscode-dotnettools#3437.
What
Import the SDK-bundled writer only when
_ProjectDataTaskAssemblyis unset. This preserves an already-imported host writer without requiring host changes and retains the bundled writer for standalone SDK builds.Add regressions for single-target, multi-target outer, and multi-target inner evaluations. Keep the existing standalone emission controls and update SDK architecture guidance.
Context freshness
Validation
Rebase update (October 7, 2026): rebased onto
mainata893b313ed0806745e7b315c249ce651cd377acf; the new PR head is5620c74ab8e3d24b392fe1329bc8ed2e88cab38e. The fix is unchanged (git range-diffreports an identical patch), and the working tree is clean. The build, test, and editor observations above predate this rebase; CI for the rebased head remains pending.