Skip to content

Update XA1006 warning text #8801

@jonpryor

Description

@jonpryor

Context: https://developercommunity.visualstudio.com/t/Maui-compile--publish-for-Play-Console-/10608668#T-ND10611876

The XA1006 warning needs to be reconsidered for a .NET world. It originated in Xamarin.Android (#2050, 55ba747), and states:

The TargetFrameworkVersion (Android API level {compileSdk}) is higher than the targetSdkVersion ({targetSdk}).

Please increase the android:targetSdkVersion in the AndroidManifest.xml so that the API levels match.

Warning XA4211 is the same-yet-different:

warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '33' is less than $(TargetFrameworkVersion) ''. Using API-34 for ACW compilation.

The problem is that $(TargetFrameworkVersion) is a Classic Xamarin.Android construct. In .NET, it would be $(TargetFramework), or maybe $(TargetPlatformVersion) (?).

There is also now a $(TargetPlatformMinVersion) property (lol?).

Then there's the NETSDK1135 error:

SupportedOSPlatformVersion <Version> cannot be higher than TargetPlatformVersion <Version>.

XA1006 & XA4211 should be updated to use the correct MSBuild property names, and also we should reconsider whether it should be emitted at all; in .NET 8, net8.0-android is net8.0-android34, and there is no earlier $(TargetPlatformVersion) value supported (i.e. net8.0-android33.0 does not exist and will error out). Consequently, every "real" .NET app will be expected to emit an XA1006, as $(TargetPlatformVersion)/"compile SDK version" will (almost) always be higher than //uses-sdk/@android:targetSdkVersion.

Steps to Reproduce

  1. Create a new project: dotnet new android

  2. Edit AndroidManifest.xml to add:

    <uses-sdk android:targetSdkVersion="33" />
  3. Build it in Release config: dotnet build -c Release

Actual results: a warning

warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '33' is less than $(TargetFrameworkVersion) ''. Using API-34 for ACW compilation.

(Aside: '' is rather offputting there…)

Desired results: do we need to warn at all anymore?

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.enhancementProposed change to current functionality.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions