Repository navigation
Preserve host-injected ProjectData targets on .NET 11 - #56522
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. |
Windows MAUI editor smoke test: PASSValidated on 2026-10-07 with the Windows x64 SDK artifact from this PR and public stable/release-channel extensions only. Created a fresh, unmodified Result: 0 CA1416 diagnostics, 0 errors, and 0 warnings. The unfiltered Problems panel had all diagnostic severities enabled. The only workspace diagnostic was informational Tested configuration
The extension versions were checked against Marketplace channel metadata and Developer: Show Running Extensions. The profile was isolated, auto-update was disabled, and no SDK and editor provenanceUsed CI build 1625215, artifact
Paths below abbreviate the private extracted This confirms the private SDK was used by the editor/project system, not merely by an integrated terminal. The Windows design-time [assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows10.0.19041.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows10.0.17763.0")]Diagnostic evidence{
"file": "MainPage.xaml.cs",
"targetFramework": "net11.0-windows10.0.19041.0",
"ca1416Count": 0,
"ca1416Diagnostics": [],
"errors": 0,
"warnings": 0,
"workspaceInfoCount": 1,
"workspaceInfoCode": "NETSDK1057",
"loadedProjects": 1,
"failedProjects": 0
}MainPage.xaml.cs and the unfiltered Problems panel: Windows editor/launch context and activated stable extension versionsThe language-status popup confirms that both the C# document context and debug target framework are Windows. Its separate Android tooling warning was not a Windows restore or project-load failure. Isolation and scope: SDK environment overrides remained process-local, with This is a passing Windows editor smoke test of the fixed SDK, not a fixed-versus-control comparison. Android was not tested because its shared tooling needs updates; iOS/MacCatalyst behavior on macOS remains unvalidated. |
4952264 to
2607032
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused import guard preserves standalone behavior and has regression coverage for single, outer, and inner evaluations.
Review effort: Balanced
Findings: None
What changed in this PR
Backports the .NET 11 ProjectData host-writer precedence fix while preserving the SDK’s standalone fallback.
Changes:
- Guards the bundled ProjectData import when a host writer is already selected.
- Adds single- and multi-targeting regression coverage.
- Documents the precedence behavior.
| File | Description |
|---|---|
src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets |
Adds the host-writer guard. |
test/Microsoft.NET.Build.Tests/GivenThatWeWantToUseProjectData.cs |
Tests host precedence across evaluation shapes. |
test/TestAssets/TestProjects/ProjectDataHostTargets/HostProjectData.targets |
Provides the simulated host writer. |
.github/memory/ARCHITECTURE.md |
Documents ProjectData import precedence. |
baronfel
left a comment
There was a problem hiding this comment.
LGTM, one note about ancillary files.
Address the approved review request on #56522 without changing the ProjectData fix or regression tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>



Description
Backport the same complete ProjectData host-writer precedence fix and regression tests as #56516 onto
release/11.0.1xx. The SDK target and both regression-test files are byte-for-byte identical to the main PR at5620c74ab8e3d24b392fe1329bc8ed2e88cab38e; this is not a functional subset. It is a separate release-based PR, without unrelated main-branch changes.The final SDK-bundled ProjectData import now requires
_ProjectDataTaskAssemblyto be empty as well as the bundled targets to exist. This preserves the target definitions and task-assembly identity of a host writer injected throughCustomAfterMicrosoftCommonTargetsorCustomAfterMicrosoftCommonCrossTargetingTargets. Standalone SDK builds still import the bundled writer when no host writer is present.Includes the same three host-injection regressions: single TFM, multi-TFM outer evaluation, and multi-TFM inner evaluation. The four existing standalone emission controls remain unchanged. Only the three product/test files are changed; no documentation changes are included. The reviewer-requested architecture-file removal is a separate docs-only commit. No version, dependency, localization, CI, or packaging changes are included.
Customer Impact
An IDE-provided ProjectData writer can be overwritten after the common-targets hooks. In the MAUI/C# Dev Kit scenario associated with the RC2 recurrence in microsoft/vscode-dotnettools#3437, this may omit expected generated assembly platform attributes and project slices, contributing to false-positive CA1416 warnings and missing iOS/MacCatalyst platforms.
A fresh, unmodified MAUI project has now passed a Windows editor smoke test with this PR's private SDK artifact and public stable extensions: zero CA1416 diagnostics, zero errors, and zero warnings. This is a fixed-SDK smoke test, not a fixed-versus-control comparison; see the evidence and limitations below.
Regression?
Likely. The unconditional bundled import was introduced by #56243, merged September 18, 2026, and backported to .NET 11. Its later import can replace an already-injected host writer. This attribution concerns the writer-precedence regression and RC2 recurrence; the original August 24 report predates that change.
Risk
Low: the production change adds one condition to an existing import. An already-selected host writer remains authoritative; the standalone bundled fallback and the existing file-existence check are preserved. No host changes, new switches, public APIs, or dependency updates are required. CI for the preceding rebased head
2607032b2dff533fe6830fb352f1bb5609e2b873has passed; CI for the documentation-only follow-up has not yet been verified. Windows editor smoke validation passed on the pre-rebase artifact with the same fix; a controlled comparison and Android/macOS editor validation remain outstanding.Testing
Reviewer-requested documentation removal (2026-10-07): separate docs-only commit
7d2420fc9420ce4a67622fbfa747b0f1c44c4c43removes only.github/memory/ARCHITECTURE.md. The SDK fix and regression tests are unchanged. No local SDK tests or large rebuild were needed for this documentation-only follow-up. CI for this new head has not yet been verified; the CI and artifact results below apply to their recorded historical heads.Pre-removal CI passed: build 1626299 completed successfully with all 11 jobs succeeded. It validates PR head
2607032b2dff533fe6830fb352f1bb5609e2b873, using CI merge commit52d30f70f53fcf58afc23ee2434c3caaa4d8b4d7onrefs/pull/56522/merge.Windows MAUI editor smoke test passed (2026-10-07): full report, editor logs, exact diagnostic counts, and screenshots. Created a fresh
.NET MAUI Appthrough the extension's normal.NET: New Project...flow, restored the Windows target and full multi-target template, selected Windows / Local Machine / Unpackaged, and openedMainPage.xaml.cs. The private SDK was confirmed in project-system logs; one project loaded and none failed. The unfiltered Problems panel showed zero CA1416 diagnostics, zero errors, and zero warnings, with only informational NETSDK1057.CounterBtn.Textresolved to the actual MAUI API, and generated AssemblyInfo contained TargetPlatform and SupportedOSPlatform attributes.Tested Windows x64 with VS Code 1.140.0, public stable C# Dev Kit 3.40.210, C# 2.160.4, MAUI extension 1.17.266, .NET Install Tool 3.2.0, SDK 11.0.100-ci, and MAUI workload/templates 11.0.0-rc.2.26472.8. The SDK artifact was from pre-rebase source head
4952264741472d505b108dce258030f9d634c89c; it does not claim editor validation of the rebased binaries. No warning suppression, application build/run, emulator/device launch, extension-development override, or application/extension source changes were used. Android and iOS/MacCatalyst editor behavior were not tested in this smoke test.Rebase provenance (2026-10-07): rebased onto
release/11.0.1xxatbd731c1e1a4d2132e93424ba15f55796e37794a0, producing pre-removal head2607032b2dff533fe6830fb352f1bb5609e2b873. There were no conflicts, andgit range-diffconfirms an unchanged patch. The artifact from build1625215, CI merge1526b9853d68d7b566f166943979fa728294134e, source head4952264741472d505b108dce258030f9d634c89c, and the packaged-SDK/startup/A-B setup observations below predate this rebase. CI for that pre-removal head is recorded separately above. No local SDK tests, large rebuild, artifact download, or editor comparison was rerun during the rebase.Performed in the release worktree: inspected the final three-file diff; confirmed product/test file parity with the main fix; parsed both targets as well-formed XML; passed
git diff --check; validated the conflict-free commit and clean working tree. Documentation links were checked before the reviewer-requested documentation removal.Not run locally in the source worktree: this worktree has neither the repo-local bootstrap SDK nor a Debug/Release redist SDK layout. No local SDK build or repository tests were run, and no large local rebuild was initiated solely for PR preparation. A system or stale SDK was not used as a substitute. Validation recorded on #56516 is not claimed as fresh validation of this release backport.
Pre-rebase Windows x64 artifact: build 1625215 published
Windows_x64_Assets. Download the artifact and extractdotnet-sdk-11.0.100-ci-win-x64.zip.The archive provenance identifies CI merge
1526b9853d68d7b566f166943979fa728294134efrom source head4952264741472d505b108dce258030f9d634c89c. Its packaged SDK contains the host-precedence guard, bundled ProjectData targets, and task assembly. Archive SHA-256:4F2F54B1FE690606518EB74ECBE5A8904ED547BCD663B716AF85C3BAAD164404.Controlled comparison prepared, not performed: two private copies of that artifact resolve SDK 11.0.100-ci and run successfully. The fixed copy is unmodified; the control removes only the import guard. Separate workspaces have global.json pins for their respective private SDKs. Global SDK installation and user PATH were not changed.
Remaining validation: a fixed-versus-control editor comparison must establish that the control reproduces the issue and the fixed SDK removes it with the same project, workloads, and extension versions. Android and macOS/iOS/MacCatalyst editor scenarios remain unvalidated by the Windows smoke test. No additional pipeline was manually triggered.