From c585240c4369801cf35d234a6e6f47517ebdd514 Mon Sep 17 00:00:00 2001 From: Milos Kotlar Date: Fri, 29 May 2026 15:24:03 +0200 Subject: [PATCH] [net11.0] bundle DynamicLibrary publish items added after _ComputePublishLocation _ComputePublishLocation resolves the final RelativePath for DynamicLibrary and PluginLibrary items in ResolvedFileToPublish, but on iOS, tvOS, and Mac Catalyst it runs early as a dependency of _CreateRuntimeConfiguration. Any item added later by an extension hooking the documented BeforeTargets="ComputeFilesToPublish" extension point keeps its raw RelativePath and lands in bin/.../publish/ instead of the signed .app bundle, because the second _ComputePublishLocation invocation is cached and skipped. This breaks the VS Code MAUI extension's CoreCLR remote-debugger flow: libvsdbgremotecoreclrtarget.dylib never reaches the bundle, CORECLR_PROFILER_PATH cannot load the profiler on launch, and every user breakpoint reports "failed to bind". Add _BundleLateDynamicLibrariesToPublish to CreateAppBundleDependsOn, between _ComputePublishLocation and _ComputeCodesignItems. It re-routes any DynamicLibrary or PluginLibrary item whose RelativePath does not already point inside _RelativeAppBundlePath so the rest of the iOS SDK pipeline (codesign, layout, mlaunch deploy) treats it like any other native dependency. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Xamarin.Shared.Sdk.targets | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 592fafb8432..be4c1f64085 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -280,6 +280,7 @@ _CompileNativeExecutable; _LinkNativeExecutable; _ComputePublishLocation; + _BundleLateDynamicLibrariesToPublish; _ComputeCodesignItems; CopyFilesToPublishDirectory; _CopyDirectoriesToBundle; @@ -2224,6 +2225,22 @@ + + + <_LateBundleDylib Include="@(ResolvedFileToPublish)" Condition="('%(ResolvedFileToPublish.PublishFolderType)' == 'DynamicLibrary' Or '%(ResolvedFileToPublish.PublishFolderType)' == 'PluginLibrary') And '%(ResolvedFileToPublish.CopyToAppBundle)' != 'false' And !$([System.String]::Copy('%(ResolvedFileToPublish.RelativePath)').StartsWith('$(_RelativeAppBundlePath)'))" /> + + + + + $(_DylibPublishDir)\%(Filename)%(Extension) + $(_RelativeAppBundlePath)\%(_LateBundleDylib.RelativePath) + PreserveNewest + + + +