-
Notifications
You must be signed in to change notification settings - Fork 561
Description
Android framework version
net9.0-android
Affected platform version
.NET 10 Preview 7
Description
This looks like it'll be a weird one…
Setup: assume a "clean machine". Specifically, that you don't have the microsoft.android.runtime.35.android-arm64 NuGet packages downloaded:
rm -Rf $HOME/.nuget/packages/microsoft.android.runtime.35.android-arm64Using .NET 10 Preview 7, create a new Android app template:
dotnet new android -n net10-android-netsdk1112
Edit net10-android-netsdk1112/net10-android-netsdk1112.csproj so that $(TargetFramework) is net9.0:
diff --git a/net10-android-netsdk1112.csproj b/net10-android-netsdk1112.csproj
index 7e6b48f..1c88b86 100644
--- a/net10-android-netsdk1112.csproj
+++ b/net10-android-netsdk1112.csproj
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net10.0-android</TargetFramework>
+ <TargetFramework>net9.0-android</TargetFramework>^M
<SupportedOSPlatformVersion>24</SupportedOSPlatformVersion>
<RootNamespace>net10_android_netsdk1112</RootNamespace>
<OutputType>Exe</OutputType>Build the project, specifying a rid:
dotnet build -r android-arm64
It fails:
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
net10-android-netsdk1112 failed with 1 error(s) (0.0s)
$HOME/Downloads/dotnet-sdk-10.0.100-preview.7.25380.108-osx-x64/sdk/10.0.100-preview.7.25380.108/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(528,5): error NETSDK1112: The runtime pack for Microsoft.Android.Runtime.35.android-arm64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'android-arm64'.
net10-android-netsdk1112 failed (4.1s) → bin/Debug/net9.0-android/android-arm64/net10-android-netsdk1112.dll
Interestingly, the NETSDK1112 only happens when (1) using .NET 10 to build a .NET 9 project and (2) specifying a rid.
If you don't specify the rid, it builds:
dotnet build
After which $HOME/.nuget/packages/microsoft.android.runtime.35.android-arm64 exists, and thus after which specifying a rid will work:
dotnet build -r android-arm64
which means that to fully reproduce this you must nuke $HOME/.nuget/packages/microsoft.android.runtime.35.android-arm64.
Alternatively, it works if you use the .NET 9 SDK to build.
rm -Rf $HOME/.nuget/packages/microsoft.android.runtime.35.android-arm64
dotnet build -r android-arm64
# works if .NET 9 is used
Steps to Reproduce
Did you find any workaround?
Either use the .NET 9 SDK, or perform a "non-rid build" before performing a rid build.