-
Notifications
You must be signed in to change notification settings - Fork 538
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
[Xamarin.Android.Build.Tasks] set %(DefineConstantsOnly)
for older API levels
#8777
Merged
jonathanpeppers
merged 1 commit into
dotnet:main
from
jonathanpeppers:InvalidTargetPlatformVersions
Mar 1, 2024
Merged
[Xamarin.Android.Build.Tasks] set %(DefineConstantsOnly)
for older API levels
#8777
jonathanpeppers
merged 1 commit into
dotnet:main
from
jonathanpeppers:InvalidTargetPlatformVersions
Mar 1, 2024
Conversation
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
…API levels Fixes: dotnet#8331 Context: dotnet#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.
/cc @rolfbjarne just to check if xamarin-macios did anything different here. |
dellis1972
approved these changes
Feb 29, 2024
rolfbjarne
approved these changes
Mar 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty much like what I did.
grendello
added a commit
that referenced
this pull request
Mar 1, 2024
* main: [Xamarin.Android.Build.Tasks] set `%(DefineConstantsOnly)` for older API levels (#8777)
grendello
added a commit
that referenced
this pull request
Mar 1, 2024
* main: [Xamarin.Android.Build.Tasks] set `%(DefineConstantsOnly)` for older API levels (#8777)
grendello
added a commit
that referenced
this pull request
Mar 6, 2024
* main: [Mono.Android] Fix race condition in AndroidMessageHandler (#8753) [ci] Fix SDL Sources Analysis for PRs from forks (#8785) [ci] Add 1ESPT override to MSBuild test stages (#8784) [ci] Do not use @self annotation for templates (#8783) [ci] Migrate to the 1ES template (#8747) [Mono.Android] fix trimming warnings, part 2 (#8758) [Xamarin.Android.Build.Tasks] set `%(DefineConstantsOnly)` for older API levels (#8777) [tests] fix duplicate sources in `NuGet.config` (#8772) Bump to xamarin/monodroid@e13723e701 (#8771)
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Mar 8, 2024
* main: (306 commits) [templates] Remove redundant "template" from display name. (dotnet#8773) Bump to xamarin/Java.Interop/main@a7e09b7 (dotnet#8793) [build] Include MIT license in most NuGet packages (dotnet#8787) Bump to dotnet/installer@893b762b6e 9.0.100-preview.3.24153.2 (dotnet#8782) [docs] update notes about `dotnet-trace` and `dotnet-gcdump` (dotnet#8713) [Mono.Android] Fix race condition in AndroidMessageHandler (dotnet#8753) [ci] Fix SDL Sources Analysis for PRs from forks (dotnet#8785) [ci] Add 1ESPT override to MSBuild test stages (dotnet#8784) [ci] Do not use @self annotation for templates (dotnet#8783) [ci] Migrate to the 1ES template (dotnet#8747) [Mono.Android] fix trimming warnings, part 2 (dotnet#8758) [Xamarin.Android.Build.Tasks] set `%(DefineConstantsOnly)` for older API levels (dotnet#8777) [tests] fix duplicate sources in `NuGet.config` (dotnet#8772) Bump to xamarin/monodroid@e13723e701 (dotnet#8771) Bump to xamarin/xamarin-android-tools/main@37d79c9 (dotnet#8752) Bump to dotnet/installer@d070660282 9.0.100-preview.3.24126.2 (dotnet#8763) Bump to xamarin/java.interop/main@14a9470 (dotnet#8766) $(AndroidPackVersionSuffix)=preview.3; net9 is 34.99.0.preview.3 (dotnet#8765) [Mono.Android] Do not dispose request content stream in AndroidMessageHandler (dotnet#8764) Bump com.android.tools:r8 from 8.2.42 to 8.2.47 (dotnet#8761) ...
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #8331
Context: #8569
Context: dotnet/sdk@25b360d
Building for
net9.0-android33
would give a poor error message: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:
I added a test for this scenario.