Skip to content

Content + PublishFolderType ignores some files (.dylib, .dll) during copy #25497

Description

@snechaev

Apple platform

macOS

Framework version

net10.0-*

Affected platform version

10.0.300 / workloads 26.5.10284

Description

I'm trying to include precompiled helper app bundle HeartBeatHandlerMac.app in the other app bundle using the following csproj settings (the precompiled helper bundle placed at ./helper/HeartBeatHandlerMac.app)

  <ItemGroup>
	<Content Include="helper/**/*">
		<PublishFolderType>RootDirectory</PublishFolderType>
		<Link>Contents/SharedSupport/%(RecursiveDir)%(Filename)%(Extension)</Link>
	</Content>
  </ItemGroup>

Expected: all files from the ./helper/HeartBeatHandlerMac.app/ will be copied in the output app bundle in the Contents/SharedSupport/ subfolder, preserving the original folder structure. For example, for debug config the expected output path will be /bin/Debug/net10.0-macos/osx-arm64/TestMacGuiApp.app/Contents/SharedSupport/HeartBeatHandlerMac.app

Observed: the SharedSupport/HeartBeatHandlerMac.app output folder exists and is not empty, but some files are missing.

Let's compare folder structures (the helper app bundle contents was truncated manually to minimize files count and simplify debug)
For the input folder (./helper):

.
└── HeartBeatHandlerMac.app
    └── Contents
        └── MonoBundle
            ├── .xamarin
            │   ├── osx-arm64
            │   │   ├── HeartBeatHandlerMac.dll
            │   │   ├── Microsoft.CSharp.dll
            │   │   ├── Microsoft.macOS.dll
            │   │   └── Microsoft.VisualBasic.dll
            │   └── osx-x64
            │       ├── HeartBeatHandlerMac.dll
            │       ├── Microsoft.CSharp.dll
            │       ├── Microsoft.macOS.dll
            │       └── Microsoft.VisualBasic.dll
            ├── AsyncIO.dll
            ├── HeartbeatHandlerLib.dll
            ├── libclrgc.dylib
            └── System.ServiceModel.Security.dll

7 directories, 12 files

For the output folder (/bin/Debug/net10.0-macos/osx-arm64/TestMacGuiApp.app/Contents/SharedSupport):

.
└── HeartBeatHandlerMac.app
    └── Contents
        └── MonoBundle
            ├── .xamarin
            │   ├── osx-arm64
            │   │   └── HeartBeatHandlerMac.dll
            │   └── osx-x64
            │       └── HeartBeatHandlerMac.dll
            ├── AsyncIO.dll
            ├── HeartbeatHandlerLib.dll
            └── System.ServiceModel.Security.dll

7 directories, 5 files

In particular, the following files are lost: libclrgc.dylib, Microsoft.macOS.dll.

Steps to Reproduce

  1. Download test project Test.zip
  2. dotnet build
  3. Inspect output folder and compare it with the sources in the helper folder. Observe that some Content files are missing.

Did you find any workaround?

In some cases we can use BundleResource instead of Content (and this copies all the files), but in this particular case, when we need specific location inside the final app bundle, that workaround is not applicable.

Build logs

See inside Test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fixmsbuildIssues affecting our msbuild tasks/targets

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions