-
Notifications
You must be signed in to change notification settings - Fork 556
Description
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 theAndroidManifest.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 thanTargetPlatformVersion
<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
-
Create a new project:
dotnet new android
-
Edit
AndroidManifest.xml
to add:<uses-sdk android:targetSdkVersion="33" />
-
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?