From 4826ec822c6535ec4b11cf55a05c397b9dd98dda Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 4 Feb 2026 17:24:12 +0100 Subject: [PATCH] [net11.0] Only create frameworks for dylibs on iOS and tvOS. --- dotnet/targets/Microsoft.Sdk.R2R.targets | 2 +- .../Tasks/ProcessRuntimeLibraries.cs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dotnet/targets/Microsoft.Sdk.R2R.targets b/dotnet/targets/Microsoft.Sdk.R2R.targets index a77398aeae65..2eef129326b4 100644 --- a/dotnet/targets/Microsoft.Sdk.R2R.targets +++ b/dotnet/targets/Microsoft.Sdk.R2R.targets @@ -37,7 +37,7 @@ - true + true true true diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ProcessRuntimeLibraries.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ProcessRuntimeLibraries.cs index 96a5735f1be8..fbe9373ed15d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ProcessRuntimeLibraries.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ProcessRuntimeLibraries.cs @@ -5,6 +5,7 @@ using Xamarin.Localization.MSBuild; using Xamarin.Messaging.Build.Client; +using Xamarin.Utils; namespace Xamarin.MacDev.Tasks; @@ -120,9 +121,15 @@ public override bool Execute () if (group.All (v => v.GetMetadata ("Extension").Equals (".a", StringComparison.OrdinalIgnoreCase))) continue; - // if we have a single .dylib, but we're linking statically, we need to convert it to a framework + // if we have a single .dylib, but we're linking statically, we need to convert it to a framework (if we're targeting a mobile platform) // if we have both a .dylib and a .a, and we're linking statically, we still need to convert the .dylib to a .framework, because the .a is ignored/irrelevant - dylibsToFrameworks.AddRange (group.Where (v => v.GetMetadata ("Extension").Equals (".dylib", StringComparison.OrdinalIgnoreCase))); + var dylib = group.Where (v => v.GetMetadata ("Extension").Equals (".dylib", StringComparison.OrdinalIgnoreCase)); + if (Platform == ApplePlatform.iOS || Platform == ApplePlatform.TVOS) { + dylibsToFrameworks.AddRange (dylib); + } else { + // on desktop just link with the dylib + output.AddRange (dylib); + } continue; case "dylib": // we don't want any .a files, but we want all .dylib files.