Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One .NET] Fix targeting API 33, build API 31 ref pack (#6896)
Fixes: #6914 The Microsoft.Android `@(KnownFrameworkReference)` will now declare targeting and runtime pack metadata that is based on the `$(TargetPlatformVersion)` of the project file. The only exception to this rule is when '$(TargetPlatformVersion)' == '31.0'; in this case the project will use an API 31 ref pack with API 32 runtime packs. The inline `Microsoft.Android.Sdk.BundledVersions.targets` file content has been moved into a separate file to improve the readability of the `@(KnownFrameworkReference)` element. Breakdown of supported `$(TargetFramework)` -> ref/runtime pack used: | `$(TargetFramework)` | Targeting Pack | Runtime Pack | | -------------------- | -------------- | ------------ | | net6.0-android | Microsoft.Android.Ref.31 | Microsoft.Android.Runtime.32 | | net6.0-android31.0 | Microsoft.Android.Ref.31 | Microsoft.Android.Runtime.32 | | net6.0-android32.0 | Microsoft.Android.Ref.32 | Microsoft.Android.Runtime.32 | | net6.0-android33.0 | Microsoft.Android.Ref.33 | Microsoft.Android.Runtime.33 | Tests have been updated accordingly, and they will now use a dynamic test case source that should make sure we don't miss any coverage when making future updates to `$(AndroidDefaultTargetDotnetApiLevel)`, `$(AndroidLatestStableApiLevel)`, and `$(AndroidLatestUnstableApiLevel)`. If an unsupported `$(TargetFramework)` is used in a project file the following errors will now be displayed: "test.csproj" (_GenerateRestoreGraphProjectEntry target) (1:5) -> (ProcessFrameworkReferences target) -> C:\Program Files\dotnet\sdk\6.0.300-preview.22211.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Ref.25' was not present in workload manifests. C:\Program Files\dotnet\sdk\6.0.300-preview.22211.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.25.android-arm' was not present in workload manifests. C:\Program Files\dotnet\sdk\6.0.300-preview.22211.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.25.android-arm64' was not present in workload manifests. C:\Program Files\dotnet\sdk\6.0.300-preview.22211.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.25.android-x86' was not present in workload manifests. C:\Program Files\dotnet\sdk\6.0.300-preview.22211.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.25.android-x64' was not present in workload manifests. Additionally, the build has been updated to produce a reference pack for the API level declared in `$(AndroidDefaultTargetDotnetApiLevel)`, if it is not the same as `$(AndroidLatestStableApiLevel)`. This will allow the default `net6.0-android` target framework to use an up to date Mono.Android.dll, instead of an older preview version from NuGet.org.
- Loading branch information
Showing
13 changed files
with
149 additions
and
83 deletions.
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
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
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
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
32 changes: 32 additions & 0 deletions
32
...oid.Build.Tasks/Microsoft.Android.Sdk/in/Microsoft.Android.Sdk.BundledVersions.in.targets
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,32 @@ | ||
<!-- | ||
*********************************************************************************************** | ||
Microsoft.Android.Sdk.BundledVersions.targets | ||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have | ||
created a backup copy. Incorrect changes to this file will make it | ||
impossible to load or build your projects from the command-line or the IDE. | ||
*********************************************************************************************** | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<AndroidNETSdkVersion>@ANDROID_PACK_VERSION_LONG@</AndroidNETSdkVersion> | ||
<XamarinAndroidVersion>@ANDROID_PACK_VERSION_LONG@</XamarinAndroidVersion> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<_AndroidTargetingPackId>$(TargetPlatformVersion.TrimEnd('.0'))</_AndroidTargetingPackId> | ||
<_AndroidRuntimePackId Condition=" '$(_AndroidTargetingPackId)' < '@ANDROID_LATEST_STABLE_API_LEVEL@' ">@ANDROID_LATEST_STABLE_API_LEVEL@</_AndroidRuntimePackId> | ||
<_AndroidRuntimePackId Condition=" '$(_AndroidRuntimePackId)' == '' ">$(_AndroidTargetingPackId)</_AndroidRuntimePackId> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<KnownFrameworkReference | ||
Include="Microsoft.Android" | ||
TargetFramework="net6.0" | ||
RuntimeFrameworkName="Microsoft.Android" | ||
LatestRuntimeFrameworkVersion="**FromWorkload**" | ||
TargetingPackName="Microsoft.Android.Ref.$(_AndroidTargetingPackId)" | ||
TargetingPackVersion="**FromWorkload**" | ||
RuntimePackNamePatterns="Microsoft.Android.Runtime.$(_AndroidRuntimePackId).**RID**" | ||
RuntimePackRuntimeIdentifiers="android-arm;android-arm64;android-x86;android-x64" | ||
Profile="Android" | ||
/> | ||
</ItemGroup> | ||
</Project> |
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
Oops, something went wrong.