From 80cfaf1c079b407d68af3a394f4fed894f58eb71 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 13:13:06 -0500 Subject: [PATCH 1/6] [build] Remove Step_PrepareProps; fold values into eng/Versions.props Continues the slow xaprepare removal (precedent: #11568, #11580, #11529). `Step_PrepareProps` generated `external/Java.Interop/Configuration.Override.props` inside the submodule by substituting two placeholders into `build-tools/scripts/Configuration.Java.Interop.Override.in.props`. The same properties are now supplied directly via `external/Java.Interop.override.props` (a checked-in static file at `external/` that Java.Interop's `Directory.Build.props` auto-imports via the parent-dir convention added in xamarin/Java.Interop#872). The shared properties (`MonoCecilVersion`, `AndroidPackVersion`, `MicrosoftAndroidSdkPackName`) move into `eng/Versions.props`, which is then imported from `Directory.Build.props`, `Configuration.props`, and the Java.Interop override. A `_XAVersionsPropsImported` sentinel guards each import to avoid an MSB4011 duplicate-import warning. Why not import dotnet/android's full `Directory.Build.props` from the Java.Interop override? Because that flips `DotNetTargetFrameworkVersion` from 10.0 to 11.0 inside Java.Interop, causing `dotnet restore` to fail with `NETSDK1045: The current .NET SDK does not support targeting .NET 11.0`. `eng/Versions.props` is collision-free with Java.Interop and safe to import. Also dropped: * `Configurables.Paths.InstallMSBuildDir` and its backing field (only consumer was `Step_PrepareProps`). * The dead `UtilityOutputFullPath` line in the old template -- Java.Interop's `TargetFrameworkDependentValues.props` unconditionally routes it to `$(UtilityOutputFullPathCoreApps)` anyway. Updated `build-tools/scripts/XAVersionInfo.targets` and `Documentation/guides/HowToBranch.md` to reflect that `AndroidPackVersion` now lives in `eng/Versions.props`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Configuration.props | 7 +--- Directory.Build.props | 9 +--- Documentation/guides/HowToBranch.md | 4 +- ...nfiguration.Java.Interop.Override.in.props | 9 ---- build-tools/scripts/XAVersionInfo.targets | 2 +- .../xaprepare/ConfigAndData/Configurables.cs | 2 - .../xaprepare/Scenarios/Scenario_Standard.cs | 1 - .../xaprepare/Steps/Step_PrepareProps.cs | 42 ------------------- eng/Versions.props | 20 +++++++++ external/Java.Interop.override.props | 9 ++++ 10 files changed, 35 insertions(+), 70 deletions(-) delete mode 100644 build-tools/scripts/Configuration.Java.Interop.Override.in.props delete mode 100644 build-tools/xaprepare/xaprepare/Steps/Step_PrepareProps.cs diff --git a/Configuration.props b/Configuration.props index faac18fa377..7c98c2e8f6d 100644 --- a/Configuration.props +++ b/Configuration.props @@ -7,7 +7,7 @@ Project="$(MSBuildThisFileDirectory)Configuration.OperatingSystem.props" Condition=" Exists('$(MSBuildThisFileDirectory)Configuration.OperatingSystem.props') And '$(DoNotLoadOSProperties)' != 'True' " /> - + Darwin $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()) - - Microsoft.Android.Sdk.Windows - Microsoft.Android.Sdk.Linux - Microsoft.Android.Sdk.Darwin - $(BuildOutputDirectory)lib\packs\ False diff --git a/Directory.Build.props b/Directory.Build.props index 61ca5916ae2..7982752d3f3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,7 @@ + + true 11.0 @@ -31,12 +33,6 @@ 16.0.0 - - 36.99.0 preview.6 false @@ -46,7 +42,6 @@ 3.3.0 1.0.0 - 0.11.5 13.0.3 5.4.0 1.3.6 diff --git a/Documentation/guides/HowToBranch.md b/Documentation/guides/HowToBranch.md index 1c3eced2df0..024b7609411 100644 --- a/Documentation/guides/HowToBranch.md +++ b/Documentation/guides/HowToBranch.md @@ -34,8 +34,8 @@ See [eng/README.md][2] for details on `darc` commands. 6. Open a PR to `dotnet/android/main`, such that `$(AndroidPackVersionSuffix)` in `Directory.Build.props` is incremented to the *next* version: `preview.43`. You may also need - to update `$(AndroidPackVersion)` if `main` needs to target a new - .NET version band. + to update `$(AndroidPackVersion)` in `eng/Versions.props` if `main` + needs to target a new .NET version band. Note that release candidates will use values such as `rc.1`, `rc.2`, etc. diff --git a/build-tools/scripts/Configuration.Java.Interop.Override.in.props b/build-tools/scripts/Configuration.Java.Interop.Override.in.props deleted file mode 100644 index 76ac996a267..00000000000 --- a/build-tools/scripts/Configuration.Java.Interop.Override.in.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - <_XamarinAndroidCecilVersion>@MonoCecilVersion@ - $(MSBuildThisFileDirectory)..\..\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\ - @MicrosoftAndroidSdkOutDir@ - $(MSBuildThisFileDirectory)..\..\external\xamarin-android-tools - - diff --git a/build-tools/scripts/XAVersionInfo.targets b/build-tools/scripts/XAVersionInfo.targets index 72083c497a4..72cd05dcd46 100644 --- a/build-tools/scripts/XAVersionInfo.targets +++ b/build-tools/scripts/XAVersionInfo.targets @@ -53,7 +53,7 @@ GetCachedPath (ref configurationPropsGeneratedPath, () => Path.Combine (BuildBinDir, "Configuration.Generated.props")); public static string MonoAndroidFrameworksSubDir = Path.Combine ("xbuild-frameworks", "MonoAndroid"); public static string MonoAndroidFrameworksRootDir => GetCachedPath (ref monoAndroidFrameworksRootDir, () => Path.Combine (XAInstallPrefix, MonoAndroidFrameworksSubDir)); - public static string InstallMSBuildDir => GetCachedPath (ref installMSBuildDir, () => ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftAndroidSdkOutDir)); // .NET 6+ public static string NetcoreAppRuntimeAndroidARM => GetCachedPath (ref netcoreAppRuntimeAndroidARM, () => GetNetcoreAppRuntimePath (ctx, "arm")); @@ -241,7 +240,6 @@ static string GetCachedPath (ref string? variable, Func creator) static string? testBinDir; static string? buildBinDir; static string? binDir; - static string? installMSBuildDir; static string? monoAndroidFrameworksRootDir; static string? externalJavaInteropDir; static string? configurationPropsGeneratedPath; diff --git a/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs b/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs index 560994a1505..862c752e07a 100644 --- a/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs +++ b/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs @@ -20,7 +20,6 @@ protected override void AddSteps (Context context) Steps.Add (new Step_InstallDotNetPreview ()); Steps.Add (new Step_GenerateFiles (atBuildStart: true)); - Steps.Add (new Step_PrepareProps ()); Steps.Add (new Step_GenerateCGManifest ()); } diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareProps.cs b/build-tools/xaprepare/xaprepare/Steps/Step_PrepareProps.cs deleted file mode 100644 index 75da0887772..00000000000 --- a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareProps.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; - -namespace Xamarin.Android.Prepare -{ - class Step_PrepareProps : Step - { - const ConsoleColor StepColor = ConsoleColor.White; - - public Step_PrepareProps () - : base ("Preparing property files") - {} - -#pragma warning disable CS1998 - protected override async Task Execute (Context context) - { - string javaInteropDir = Configurables.Paths.ExternalJavaInteropDir; - - LogStep (context, "Configuring Java.Interop property overrides"); - var jiOverrideProps = new GeneratedPlaceholdersFile ( - new Dictionary (StringComparer.Ordinal) { - { "@MonoCecilVersion@", Context.Instance.Properties.GetRequiredValue (KnownProperties.MonoCecilVersion) }, - { "@MicrosoftAndroidSdkOutDir@", Configurables.Paths.InstallMSBuildDir } - }, - Path.Combine (Configurables.Paths.BuildToolsScriptsDir, "Configuration.Java.Interop.Override.in.props"), - Path.Combine (javaInteropDir, "Configuration.Override.props") - ); - jiOverrideProps.Generate (context); - - return true; - } - - void LogStep (Context context, string step) - { - Log.StatusLine ($" {context.Characters.Bullet} {step}", StepColor); - } - -#pragma warning restore CS1998 - } -} diff --git a/eng/Versions.props b/eng/Versions.props index f1e542936ce..258170658ec 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,5 +1,10 @@ + + + <_XAVersionsPropsImported>true + 11.0.100-preview.5.26268.112 $(MicrosoftNETSdkPackageVersion) @@ -33,4 +38,19 @@ $(DotNetPreviewVersionBand) + + + 0.11.5 + + 36.99.0 + Microsoft.Android.Sdk.Windows + Microsoft.Android.Sdk.Linux + Microsoft.Android.Sdk.Darwin + diff --git a/external/Java.Interop.override.props b/external/Java.Interop.override.props index 530fe2d9d48..f1d88fd07d1 100644 --- a/external/Java.Interop.override.props +++ b/external/Java.Interop.override.props @@ -1,8 +1,17 @@ + + + $(MSBuildThisFileDirectory)xamarin-android-tools True + <_XamarinAndroidCecilVersion>$(MonoCecilVersion) + $(MSBuildThisFileDirectory)..\bin\$(Configuration)\lib\packs\$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\tools\ https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-2b2a06c8/nuget/v3/index.json; From 3ca0e9aca04f40b093d68d680546617b91a6124f Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 13:17:09 -0500 Subject: [PATCH 2/6] [build] Drop sentinel; single Versions.props import site Configuration.props no longer needs to import eng/Versions.props itself. In every MSBuild path that imports Configuration.props, Directory.Build.props has already been loaded (either by MSBuild auto-load, or by the explicit in external/xamarin-android-tools.override.props). Since Directory.Build.props imports eng/Versions.props, the properties are always available. This means there is no duplicate-import scenario, so the _XAVersionsPropsImported sentinel can be removed too. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Configuration.props | 1 - Directory.Build.props | 2 +- eng/Versions.props | 5 ----- external/Java.Interop.override.props | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Configuration.props b/Configuration.props index 7c98c2e8f6d..7ea7cc65431 100644 --- a/Configuration.props +++ b/Configuration.props @@ -7,7 +7,6 @@ Project="$(MSBuildThisFileDirectory)Configuration.OperatingSystem.props" Condition=" Exists('$(MSBuildThisFileDirectory)Configuration.OperatingSystem.props') And '$(DoNotLoadOSProperties)' != 'True' " /> - - + true diff --git a/eng/Versions.props b/eng/Versions.props index 258170658ec..3a8867e1ed9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,10 +1,5 @@ - - - <_XAVersionsPropsImported>true - 11.0.100-preview.5.26268.112 $(MicrosoftNETSdkPackageVersion) diff --git a/external/Java.Interop.override.props b/external/Java.Interop.override.props index f1d88fd07d1..23f5a6deca3 100644 --- a/external/Java.Interop.override.props +++ b/external/Java.Interop.override.props @@ -5,7 +5,7 @@ This file is restricted to collision-free package-version-shaped properties; importing the full Directory.Build.props/Configuration.props chain would overwrite Java.Interop's own DotNetTargetFrameworkVersion. --> - + $(MSBuildThisFileDirectory)xamarin-android-tools From 1393b8e3a122093752880269f06b3f06b5b15396 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 13:20:24 -0500 Subject: [PATCH 3/6] [build] Move MicrosoftAndroidSdkPackName back to Configuration.props It is OS-conditioned, not version-shaped, so it does not belong in eng/Versions.props. Mirror the same 3-line block inline in external/Java.Interop.override.props (as a private _MicrosoftAndroidSdkPackName so it cannot leak into the Java.Interop build) to keep Versions.props limited to pure version values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Configuration.props | 5 +++++ eng/Versions.props | 3 --- external/Java.Interop.override.props | 21 +++++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Configuration.props b/Configuration.props index 7ea7cc65431..4af1c485c98 100644 --- a/Configuration.props +++ b/Configuration.props @@ -53,6 +53,11 @@ Darwin $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()) + + Microsoft.Android.Sdk.Windows + Microsoft.Android.Sdk.Linux + Microsoft.Android.Sdk.Darwin + $(BuildOutputDirectory)lib\packs\ False diff --git a/eng/Versions.props b/eng/Versions.props index 3a8867e1ed9..ac89f6bf901 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,8 +44,5 @@ * Bump first digit of the patch version for feature releases (and reset the first two digits to 0) --> 36.99.0 - Microsoft.Android.Sdk.Windows - Microsoft.Android.Sdk.Linux - Microsoft.Android.Sdk.Darwin diff --git a/external/Java.Interop.override.props b/external/Java.Interop.override.props index 23f5a6deca3..1741aae7ac0 100644 --- a/external/Java.Interop.override.props +++ b/external/Java.Interop.override.props @@ -1,20 +1,29 @@ - + $(MSBuildThisFileDirectory)xamarin-android-tools True <_XamarinAndroidCecilVersion>$(MonoCecilVersion) - $(MSBuildThisFileDirectory)..\bin\$(Configuration)\lib\packs\$(MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\tools\ https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-2b2a06c8/nuget/v3/index.json; + + + <_MicrosoftAndroidSdkPackName Condition="$([MSBuild]::IsOSPlatform('windows'))">Microsoft.Android.Sdk.Windows + <_MicrosoftAndroidSdkPackName Condition="$([MSBuild]::IsOSPlatform('linux'))">Microsoft.Android.Sdk.Linux + <_MicrosoftAndroidSdkPackName Condition="$([MSBuild]::IsOSPlatform('osx'))">Microsoft.Android.Sdk.Darwin + $(MSBuildThisFileDirectory)..\bin\$(Configuration)\lib\packs\$(_MicrosoftAndroidSdkPackName)\$(AndroidPackVersion)\tools\ + + From 82c5215dc5d5a410246412eb56a098b127fc847c Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 13:21:17 -0500 Subject: [PATCH 4/6] [build] Move AndroidPackVersionSuffix to eng/Versions.props Sits next to AndroidPackVersion now, where it logically belongs. Updated Documentation/guides/HowToBranch.md to reflect the new location. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Build.props | 1 - Documentation/guides/HowToBranch.md | 2 +- eng/Versions.props | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 4decad7b0eb..1be1fe4ce43 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,6 @@ 16.0.0 - preview.6 false diff --git a/Documentation/guides/HowToBranch.md b/Documentation/guides/HowToBranch.md index 024b7609411..559433559d9 100644 --- a/Documentation/guides/HowToBranch.md +++ b/Documentation/guides/HowToBranch.md @@ -32,7 +32,7 @@ darc add-default-channel --channel ".NET 10.0.1xx SDK Preview 42" --branch "rele See [eng/README.md][2] for details on `darc` commands. 6. Open a PR to `dotnet/android/main`, such that - `$(AndroidPackVersionSuffix)` in `Directory.Build.props` is + `$(AndroidPackVersionSuffix)` in `eng/Versions.props` is incremented to the *next* version: `preview.43`. You may also need to update `$(AndroidPackVersion)` in `eng/Versions.props` if `main` needs to target a new .NET version band. diff --git a/eng/Versions.props b/eng/Versions.props index ac89f6bf901..7196c1105f5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,5 +44,6 @@ * Bump first digit of the patch version for feature releases (and reset the first two digits to 0) --> 36.99.0 + preview.6 From d459a694e1e5e84a7b11c671161727cc07eb2dd4 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 20:31:33 -0500 Subject: [PATCH 5/6] [tests] Also copy eng/Versions.props in CodeBehindTests temp setup CodeBehindTests.PrepareProject copies the repo Directory.Build.props into a per-test temp root so the synthesized project under temp/CodeBehind/... sees our shared MSBuild props. After this PR, Directory.Build.props unconditionally imports eng/Versions.props, so the copy must include that file too -- otherwise MSB4019 fires on every CodeBehindTests build: Directory.Build.props(3,3): error MSB4019: The imported project ".../temp/CodeBehind/.../eng/Versions.props" was not found. CopyFile already creates intermediate directories, so a single extra line that places it under tempRoot/eng/Versions.props is sufficient. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- external/Java.Interop | 2 +- .../Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index b881d21f51c..e38211334a7 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit b881d21f51cbac6e175de1b2f6c254fe3846aa1d +Subproject commit e38211334a73cb77656324ce2eeefb16707ef5a2 diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs index f24b67f3599..c1af443792c 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs @@ -734,6 +734,7 @@ string PrepareProject (string testName, bool isRelease, AndroidRuntime runtime) CopyRecursively (TestProjectRootDirectory, temporaryProjectPath, ignore); CopyRecursively (CommonSampleLibraryRootDirectory, Path.Combine (tempRoot, CommonSampleLibraryName), ignore); CopyFile (Path.Combine (XABuildPaths.TopDirectory, "Directory.Build.props"), Path.Combine (tempRoot, "Directory.Build.props" )); + CopyFile (Path.Combine (XABuildPaths.TopDirectory, "eng", "Versions.props"), Path.Combine (tempRoot, "eng", "Versions.props")); var project = new XamarinAndroidApplicationProject (); project.CopyNuGetConfig (Path.Combine (tempRoot, "NuGet.config")); From 3da357eae2c065b6bff7ffa4e91b688cd8b599ae Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 9 Jun 2026 20:32:04 -0500 Subject: [PATCH 6/6] Restore external/Java.Interop submodule pointer to b881d21 Accidentally rolled back in d459a694e by `git add -A` while the submodule worktree still pointed at the pre-merge commit. The merge with main had correctly taken b881d21 from origin/main; this re-applies that pointer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- external/Java.Interop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index e38211334a7..b881d21f51c 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit e38211334a73cb77656324ce2eeefb16707ef5a2 +Subproject commit b881d21f51cbac6e175de1b2f6c254fe3846aa1d