forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] introduce
XA1038
Fixes: dotnet#8331 Building a `net8.0-android33` project, currently fails with: error NETSDK1181: Error getting pack version: Pack 'Microsoft.Android.Ref.33' was not present in workload manifests. C:\Program Files\dotnet\sdk\8.0.100-preview.7.23376.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets To solve this, you would either change 33 to 34, or just remove the number to rely on the default value. To make this easier: * Automatically switch to 34 if the user specifies 33 or less. * Emit the new `XA1038` error message. This allows these projects to build with a reasonable error message. The only concern down the road: if we ever support `net8.0-android35` alongside `net8.0-android34`, then we'd need to slightly adjust the logic here.
- Loading branch information
1 parent
a10aa38
commit 92c21cd
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Xamarin.Android error XA1038 | ||
description: XA1038 error code | ||
ms.date: 12/6/2023 | ||
--- | ||
# Xamarin.Android error XA1038 | ||
|
||
## Example messages | ||
|
||
``` | ||
error XA1038: $(TargetPlatformVersion) 33 is not a valid target for `net8.0-android` projects. Please update your $(TargetPlatformVersion) to a supported version (e.g. 34). | ||
``` | ||
|
||
## Issue | ||
|
||
This error indicates that you have a mismatch between the | ||
`$(TargetPlatformVersion)` set and what .NET Android supports. | ||
|
||
For example: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<TargetFramework>net8.0-android33</TargetFramework> | ||
</PropertyGroup> | ||
``` | ||
|
||
In this case, .NET 8 targets Android 34, which is the default and valid | ||
`$(TargetPlatformVersion)`, but the `$(TargetPlatformVersion)` is set to 33. | ||
`TargetFramework=net8.0-android33` above is shorthand for: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<TargetPlatformIdentifier>android</TargetPlatformIdentifier> | ||
<TargetPlatformVersion>33.0</TargetPlatformVersion> | ||
</PropertyGroup> | ||
``` | ||
|
||
## Solution | ||
|
||
Change the value of the `$(TargetPlatformVersion)` property to match a supported | ||
version for the `$(TargetFramework)`, or remove the value entirely to rely on | ||
the default: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<TargetFramework>net8.0-android</TargetFramework> | ||
</PropertyGroup> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters