Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XA1006 warning text #8801

Open
jonpryor opened this issue Mar 8, 2024 · 0 comments
Open

Update XA1006 warning text #8801

jonpryor opened this issue Mar 8, 2024 · 0 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. enhancement Proposed change to current functionality.
Milestone

Comments

@jonpryor
Copy link
Member

jonpryor commented Mar 8, 2024

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?

@jonpryor jonpryor added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Mar 8, 2024
@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Mar 8, 2024
@jpobst jpobst added this to the .NET 9 milestone Mar 8, 2024
@jpobst jpobst added the enhancement Proposed change to current functionality. label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects. enhancement Proposed change to current functionality.
Projects
None yet
Development

No branches or pull requests

4 participants