Skip to content

Add UseMonoRuntime condition to API levels 21, 22, 23 in SupportedPlatforms generator#10753

Merged
jonathanpeppers merged 3 commits intomainfrom
copilot/add-conditional-platform-versions
Feb 3, 2026
Merged

Add UseMonoRuntime condition to API levels 21, 22, 23 in SupportedPlatforms generator#10753
jonathanpeppers merged 3 commits intomainfrom
copilot/add-conditional-platform-versions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 2, 2026

API levels 21, 22, 23 are only supported by the Mono runtime, not CoreCLR/NativeAOT. The GenerateSupportedPlatforms task needs to emit these with a $(UseMonoRuntime) condition.

Changes

  • Configuration.props: Add AndroidMinimumNonMonoApiLevel property (23) defining the minimum API level for non-Mono runtimes
  • GenerateSupportedPlatforms.cs: Add MinimumNonMonoApiLevel parameter; versions below this threshold get a Condition attribute
  • Xamarin.Android.Build.Tasks.targets: Pass the new parameter to the task

Generated Output

<AndroidSdkSupportedTargetPlatformVersion Include="21.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="22.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="23.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="24.0" DefineConstantsOnly="true" />
<!-- ... -->
Original prompt

Review the file generated at src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\Microsoft.Android.Sdk.SupportedPlatforms.targets

We need these two lines conditional on the Mono runtime:

    <AndroidSdkSupportedTargetPlatformVersion Include="21.0" DefineConstantsOnly="true" />
    <AndroidSdkSupportedTargetPlatformVersion Include="22.0" DefineConstantsOnly="true" />

So they should have a Condition for when $(UseMonoRuntime) is true.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…tforms generator

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Add conditional supported platform versions for Mono runtime Add UseMonoRuntime condition to API levels 21 and 22 in SupportedPlatforms generator Feb 2, 2026
Copilot AI requested a review from jonathanpeppers February 2, 2026 18:10
@jonathanpeppers jonathanpeppers changed the title Add UseMonoRuntime condition to API levels 21 and 22 in SupportedPlatforms generator Add UseMonoRuntime condition to API levels 21, 22, 23 in SupportedPlatforms generator Feb 2, 2026
@jonathanpeppers jonathanpeppers marked this pull request as ready for review February 2, 2026 20:19
@jonathanpeppers jonathanpeppers merged commit 38eca38 into main Feb 3, 2026
6 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/add-conditional-platform-versions branch February 3, 2026 14:16
simonrozsival pushed a commit that referenced this pull request Feb 5, 2026
…0753)

API levels 21, 22, 23 are only supported by the Mono runtime, not CoreCLR/NativeAOT.

The `<GenerateSupportedPlatforms/>` MSBuild task needs to emit these with a `$(UseMonoRuntime)` condition.

### Changes

- **Configuration.props**: Add `AndroidMinimumNonMonoApiLevel` property (24) defining the minimum API level for non-Mono runtimes
- **GenerateSupportedPlatforms.cs**: Add `MinimumNonMonoApiLevel` parameter; versions below this threshold get a `Condition` attribute
- **Xamarin.Android.Build.Tasks.targets**: Pass the new parameter to the task

### Generated Output

```xml
<AndroidSdkSupportedTargetPlatformVersion Include="21.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="22.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="23.0" DefineConstantsOnly="true" Condition=" '$(UseMonoRuntime)' == 'true' " />
<AndroidSdkSupportedTargetPlatformVersion Include="24.0" DefineConstantsOnly="true" />
<!-- ... -->
```

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants