Repository navigation
[docs] Align MSBuild and Java.Interop agent instructions - #13790
Merged
Merged
Conversation
Context: #10893 Context: #12678 Context: #13500 Context: #13756 Follow-up audit of repository agent instructions and code-review rules surfaced three places where our documented guidance contradicts MSBuild evaluation semantics or current repository conventions: * `<UsingTask/>` hosting across shipped assemblies: `.github/copilot-instructions.md`, `.github/instructions/msbuild.instructions.md`, and `.github/skills/code-review/references/msbuild-rules.md` carried a blanket ban from #10893 against putting `TaskFactory="TaskHostFactory"` or `Runtime="NET"` on any shipped `<UsingTask/>`. Since #12678 introduced `$(_MicrosoftAndroidBuildTasksAssembly)` (`Microsoft.Android.Build.Tasks.dll`, targeting `$(DotNetTargetFramework)`), all 38 shipped modern-.NET tasks register as a conditioned pair (`Runtime="NET" TaskFactory="TaskHostFactory" Condition=" '$(MSBuildRuntimeType)' == 'Full' "` and `Runtime="NET" Condition=" '$(MSBuildRuntimeType)' == 'Core' "`, asserted in `NativeAotBootstrapTargetsTests`). Document the actual three-way convention: unconditional `TaskFactory="TaskHostFactory" Runtime="NET"` for internal `xa-prep-tasks`/`BootstrapTasks`, neither attribute on shipped `netstandard2.0` task assemblies, and the `'Full'`/`'Core'` conditioned pair (never an unconditioned `TaskHostFactory`) on `$(_MicrosoftAndroidBuildTasksAssembly)`. * `DependsOnTargets` vs `Condition` evaluation order: `.github/instructions/msbuild.instructions.md` stated in its `Inputs` section that `DependsOnTargets` runs *before* the parent target's `Condition`, `Inputs`, and `Outputs`, contradicting its own later section (`A target's Condition is evaluated before its DependsOnTargets`) and MSBuild's `TargetEntry.ExecuteEntry`. Align both files (`.github/instructions/msbuild.instructions.md` and `.github/skills/code-review/references/msbuild-rules.md`) to state that MSBuild evaluates `Condition` before scheduling `DependsOnTargets`, and runs `DependsOnTargets` before evaluating `Inputs` and `Outputs` (#13500). * `$(DotNetStableTargetFramework)` drift in Java.Interop docs: `.github/instructions/java-interop.instructions.md` and `Documentation/Java.Interop/BuildConfiguration.md` hardcoded `.NET 10` / `net10.0/`, whereas `Directory.Build.props` now sets `<DotNetStableTargetFramework>net11.0</DotNetStableTargetFramework>`. Reference `$(DotNetStableTargetFramework)` directly and note `netstandard2.0` shared-library and `$(TestOutputDirectory)` output roots accurately so future TFM bumps do not go stale. Validation: Documentation-only Markdown changes; no SDK build or device tests required per `.github/copilot-instructions.md`. Verified all 166 `<UsingTask/>` elements across all 62 `.targets` files under `src/`, `NativeAotBootstrapTargetsTests.cs`, `Directory.Build.props`, and all Java.Interop `.csproj` files against the updated wording. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PureWeen
requested review from
jonathanpeppers and
simonrozsival
as code owners
November 26, 2026 04:38
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the documentation-only updates to MSBuild and Java.Interop guidance.
No open issues 🎉
What changed in this PR
This documentation-only PR aligns .NET for Android’s agent instructions and review rules with current MSBuild behavior and Java.Interop build conventions.
Changes:
- Distinguishes task-hosting rules for internal tasks, shipped
netstandard2.0tasks, and shipped modern-.NET tasks. - Clarifies that target conditions are evaluated before dependencies, while incremental inputs and outputs are evaluated afterward.
- Replaces hardcoded Java.Interop framework versions with shared properties and clarifies output directories.
| File | Description |
|---|---|
Documentation/Java.Interop/BuildConfiguration.md |
Clarifies framework-based output paths and shared-library exceptions. |
.github/skills/code-review/references/msbuild-rules.md |
Aligns hosting and target-evaluation review guidance. |
.github/instructions/msbuild.instructions.md |
Corrects evaluation order and documents three-way hosting rules. |
.github/instructions/java-interop.instructions.md |
Uses framework properties instead of a hardcoded .NET version. |
.github/copilot-instructions.md |
Replaces the blanket shipped-task hosting ban with assembly-specific guidance. |
Review effort: Balanced
|
Reviewed the docs-only alignment. What I checked:
Docs-only, no build or test impact. Nothing blocking from me. |
simonrozsival
approved these changes
Nov 26, 2026
This was referenced Nov 26, 2026
simonrozsival
added a commit
that referenced
this pull request
Nov 27, 2026
Context: #13521 Context: #13728 Context: #13790 An expanded review of all stored conversation turns in 1,558 remaining local dotnet/android candidate sessions found recurring test-scope churn, overbuilt solutions, and build/environment validation pitfalls. The review used 50 subagents; 1,486 sessions had stored turns and 72 had none. The candidate filter can include non-coding conversations, and stored turns are not full raw tool transcripts. ### Test and review guidance Test additions repeatedly needed scope reductions when they duplicated existing coverage, asserted implementation shape, or used brittle GC-timing assumptions. The guidance now emphasizes unique behavioral or regression protection while preserving meaningful characterization tests. The code-review skill no longer requires a comment on clean PRs or a full-file read when relevant context is sufficient. ### Build and runtime experiments The review confirmed shared SDK/JDK path hazards and missing submodule prerequisites; local-build guidance now checks resolved paths, and the tests skill now lists the SourceLink workaround next to standalone `dotnet test`, where agents in fresh worktrees hit it. Manual submodule guidance already merged in #13780; automatic initialization is a separate build change in #13797, with no build-code changes here. Historical `make all` failures predate the existing `make leeroy` guidance. In one requested runtime experiment, successful builds and `dotnet test --no-build` exercised baseline rather than candidate artifacts, so the device skill now advises verifying manually replaced APK/native-library candidates. ### Correctness and shortening Review rules contained inaccurate test-fixture, JNI, GC, and Android stack claims; these were corrected. MSBuild guidance now permits skipping incrementality when required side effects or incomplete inputs/outputs make it unsafe, and avoids requiring helper targets for inputs already available during evaluation. Rebasing onto main preserves #13790's task-hosting rules, Condition/DependsOnTargets ordering, and Java.Interop target-framework corrections unchanged rather than duplicating or replacing them. The always-loaded instructions now enable NRT for new code without converting existing code unless asked. Duplicated commands, examples, and unconditional rules were removed or shortened. Net change against the rebased main: **−138 lines** (+52/−190 across 11 instruction/skill files); `copilot-instructions.md` shrinks from 287 to 150 lines.
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
2e6affde3970cb83f991fd3f38044ac2b2fc2165<UsingTask/>registrations across 62src/.targetsfiles (including all 38'Full'/'Core'conditioned pairs on$(_MicrosoftAndroidBuildTasksAssembly)andNativeAotBootstrapTargetsTests.cs), MSBuild'sTargetEntry.ExecuteEntryevaluation order,Directory.Build.props, and all Java.Interop.csprojoutput/TFM properties.↑ Reviewed the final diff with an independent
rubber-duckpass.↓ Downstream automated review behavior on future PRs is only observable once new PRs run against the updated instructions.
Context: #10893
Context: #12678
Context: #13500
Context: #13756
Follow-up audit of repository agent instructions and code-review rules surfaced three places where documented guidance contradicts MSBuild evaluation semantics or current repository conventions:
<UsingTask/>hosting across shipped assemblies:.github/copilot-instructions.md,.github/instructions/msbuild.instructions.md, and.github/skills/code-review/references/msbuild-rules.mdcarried a blanket ban from Add TaskFactory="TaskHostFactory" Runtime="NET" to xa-prep-tasks and BootstrapTasks UsingTask elements #10893 against puttingTaskFactory="TaskHostFactory"orRuntime="NET"on any shipped<UsingTask/>. Since [xabt] Move trimmable typemap tasks to net11 #12678 introduced$(_MicrosoftAndroidBuildTasksAssembly)(Microsoft.Android.Build.Tasks.dll, targeting$(DotNetTargetFramework)), all 38 shipped modern-.NET tasks register as a conditioned pair (Runtime="NET" TaskFactory="TaskHostFactory" Condition=" '$(MSBuildRuntimeType)' == 'Full' "andRuntime="NET" Condition=" '$(MSBuildRuntimeType)' == 'Core' ", asserted inNativeAotBootstrapTargetsTests). Document the actual three-way convention: unconditionalTaskFactory="TaskHostFactory" Runtime="NET"for internalxa-prep-tasks/BootstrapTasks, neither attribute on shippednetstandard2.0task assemblies, and the'Full'/'Core'conditioned pair (never an unconditionedTaskFactory="TaskHostFactory") on$(_MicrosoftAndroidBuildTasksAssembly).DependsOnTargetsvsConditionevaluation order:.github/instructions/msbuild.instructions.mdstated in itsInputssection thatDependsOnTargetsruns before the parent target'sCondition,Inputs, andOutputs, contradicting its own later section (A target's Condition is evaluated before its DependsOnTargets) and MSBuild'sTargetEntry.ExecuteEntry. Align both.github/instructions/msbuild.instructions.mdand.github/skills/code-review/references/msbuild-rules.mdto state that MSBuild evaluatesConditionbefore schedulingDependsOnTargets, and runsDependsOnTargetsbefore evaluatingInputsandOutputs([Xamarin.Android.Build.Tasks] Replace Lint with MSBuild targets #13500).$(DotNetStableTargetFramework)drift in Java.Interop docs:.github/instructions/java-interop.instructions.mdandDocumentation/Java.Interop/BuildConfiguration.mdhardcoded.NET 10/net10.0/, whereasDirectory.Build.propssets<DotNetStableTargetFramework>net11.0</DotNetStableTargetFramework>. Reference$(DotNetStableTargetFramework)directly and notenetstandard2.0shared-library and$(TestOutputDirectory)output roots accurately so future TFM bumps do not go stale.Validation: Documentation-only Markdown changes; no SDK build or device tests required per
.github/copilot-instructions.md. Deterministically verified all 166<UsingTask/>elements across all 62.targetsfiles undersrc/,NativeAotBootstrapTargetsTests.cs,Directory.Build.props, and all Java.Interop.csprojfiles against the updated wording.