Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 510e8a0

Browse files
[android] add .NET 8 multi-targeting support (#50)
Context: dotnet/android#7900 After attempted removal of .NET 6 (from .NET 8), we got the build error: Xamarin.Legacy.Android.targets(33,3): error : Could not resolve SDK "Microsoft.Android.Sdk.net6". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK. Xamarin.Legacy.Android.targets(33,3): error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null. Xamarin.Legacy.Android.targets(33,3): error : The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json. Xamarin.Legacy.Android.targets(33,3): error : MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Android.Sdk.net6" because directory "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/sdk/8.0.100-preview.3.23163.4/Sdks/Microsoft.Android.Sdk.net6/Sdk" did not exist. Add support for the .NET 8 SDK, I am unsure how it was working at all before? It must have somehow imported the .NET 6 targets.
1 parent 3489d96 commit 510e8a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Xamarin.Legacy.Sdk/Sdk/Xamarin.Legacy.Android.targets

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
Project="../targets/Microsoft.Android.Sdk.DefaultProperties.targets"
3232
/>
3333
<Import
34-
Condition=" '$(UseMicrosoftAndroidSdk)' != 'true' and ('$(UseMicrosoftAndroidSdkNet6)' == 'true' or !$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')))"
34+
Condition=" '$(UseMicrosoftAndroidSdk)' != 'true' and ('$(UseMicrosoftAndroidSdkNet6)' == 'true' or $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')))"
3535
Sdk="Microsoft.Android.Sdk.net6"
3636
Project="../targets/Microsoft.Android.Sdk.DefaultProperties.targets"
3737
/>
@@ -40,6 +40,11 @@
4040
Sdk="Microsoft.Android.Sdk.net7"
4141
Project="../targets/Microsoft.Android.Sdk.DefaultProperties.targets"
4242
/>
43+
<Import
44+
Condition=" '$(UseMicrosoftAndroidSdk)' != 'true' and ('$(UseMicrosoftAndroidSdkNet8)' == 'true' or $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')))"
45+
Sdk="Microsoft.Android.Sdk.net8"
46+
Project="../targets/Microsoft.Android.Sdk.DefaultProperties.targets"
47+
/>
4348
<Import Project="$(_LegacyExtensionsPath)/Xamarin/Android/Xamarin.Android.CSharp.targets" Condition=" '$(IsBindingProject)' != 'true' and '$(_FixupsNeeded)' == 'true' " />
4449
<Import Project="$(_LegacyExtensionsPath)/Xamarin/Android/Xamarin.Android.Bindings.targets" Condition=" '$(IsBindingProject)' == 'true' and '$(_FixupsNeeded)' == 'true' " />
4550
<Import Project="$(MSBuildExtensionsPath)/Xamarin/Android/Xamarin.Android.CSharp.targets" Condition=" '$(IsBindingProject)' != 'true' and '$(_FixupsNeeded)' != 'true' " />

0 commit comments

Comments
 (0)