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] set
%(DefineConstantsOnly)
for older …
…API levels (#8777) Fixes: #8331 Context: #8569 Context: dotnet/sdk@25b360d Building for `net9.0-android33` would give a poor error message: 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. * Opt into `%(DefineConstantsOnly)=true` for API levels 21-33 (and not the latest), which allows the .NET SDK to emit the *better* .NET SDK error message instead. So now users will get: (_CheckForInvalidTargetPlatformVersion target) -> dotnet/sdk/9.0.100-alpha.1.23628.5/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(243,5): error NETSDK1140: 33.0 is not a valid TargetPlatformVersion for Android. Valid versions include: 34.0 I added a test for this scenario.
- Loading branch information