From 49a1305bfdb3bf9effd0b414b7a237c4a0b193e2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 7 Jul 2026 17:46:07 +0200 Subject: [PATCH 1/3] [msbuild] Deprecate NoBindingEmbedding=false in .NET 11, remove in .NET 12 Setting `NoBindingEmbedding=false` (embedding native libraries in the managed assembly) should no longer be necessary (and doesn't even work with .xcframeworks, only .frameworks, .a and .dylib files). However, supporting it duplicates the testing matrix for binding projects, and it's also a source of bugs, so start the process of removing support for it. Setting `NoBindingEmbedding=false` will now be deprecated in .NET 11 with a build warning, and produces a build error in .NET 12+. And then at some point after .NET 12+ we can remove any supporting code/tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/building-apps/build-properties.md | 3 +++ msbuild/Xamarin.Shared/Xamarin.Shared.ObjCBinding.targets | 2 ++ msbuild/Xamarin.Shared/Xamarin.Shared.props | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/docs/building-apps/build-properties.md b/docs/building-apps/build-properties.md index 78a10c4c2d9d..f9dda3f67192 100644 --- a/docs/building-apps/build-properties.md +++ b/docs/building-apps/build-properties.md @@ -1065,6 +1065,9 @@ Default: ## NoBindingEmbedding +> [!WARNING] +> Setting this property to `false` is deprecated in .NET 11 and will produce a build error in .NET 12+. + A boolean property that specifies whether native libraries in binding projects should be embedded in the managed assembly, or put into a `.resources` directory next to the managed assembly. diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.ObjCBinding.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.ObjCBinding.targets index f19bd85afd39..8344ee9b09ea 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.ObjCBinding.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.ObjCBinding.targets @@ -110,6 +110,8 @@ Copyright (C) 2020 Microsoft. All rights reserved. + + true + + <_NoBindingEmbeddingDeprecated Condition="'$(NoBindingEmbedding)' != 'true' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 11.0)) And !$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 12.0))">true + <_NoBindingEmbeddingRemoved Condition="'$(NoBindingEmbedding)' != 'true' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 12.0))">true + <_DisableBindingProjectBuild Condition="'$(_DisableBindingProjectBuild)' == '' And '$(BundleOriginalResources)' != 'true' And '$(DesignTimeBuild)' == 'true'">true From 5c83e8249e67f3d56fb3670ac43fe06f48aefa8a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 7 Jul 2026 18:01:34 +0200 Subject: [PATCH 2/3] Deprecate right away, no need to wait for .NET 11. --- msbuild/Xamarin.Shared/Xamarin.Shared.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.props b/msbuild/Xamarin.Shared/Xamarin.Shared.props index 4cb770005d8a..76d4df36608d 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.props +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.props @@ -244,8 +244,8 @@ Copyright (C) 2020 Microsoft. All rights reserved. true - - <_NoBindingEmbeddingDeprecated Condition="'$(NoBindingEmbedding)' != 'true' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 11.0)) And !$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 12.0))">true + + <_NoBindingEmbeddingDeprecated Condition="'$(NoBindingEmbedding)' != 'true' And !$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 12.0))">true <_NoBindingEmbeddingRemoved Condition="'$(NoBindingEmbedding)' != 'true' And $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 12.0))">true From 4431207567777aee968066b9c3c1a046934613be Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 8 Jul 2026 13:52:27 +0200 Subject: [PATCH 3/3] Apply suggestion from @rolfbjarne --- docs/building-apps/build-properties.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/building-apps/build-properties.md b/docs/building-apps/build-properties.md index f9dda3f67192..ace131c722fd 100644 --- a/docs/building-apps/build-properties.md +++ b/docs/building-apps/build-properties.md @@ -1066,7 +1066,7 @@ Default: ## NoBindingEmbedding > [!WARNING] -> Setting this property to `false` is deprecated in .NET 11 and will produce a build error in .NET 12+. +> Setting this property to `false` is currently deprecated and will produce a build error in .NET 12+. A boolean property that specifies whether native libraries in binding projects should be embedded in the managed assembly, or put into a `.resources` directory next to the managed assembly.