Skip to content

Content + PublishFolderType do not copy file in the app bundle in Release configuration #25053

@snechaev

Description

@snechaev

Apple platform

macOS

Framework version

net10.0-*

Affected platform version

.net 10.0.201, macos workload 26.2.10217/10.0.100

Description

I'm trying to copy test.txt as a resource into the app bundle. I use the following in my csproj:

    <ItemGroup>
        <None Remove="test.txt"/>
        <Content Include="test.txt">
<!--            <CopyToOutputDirectory>Always</CopyToOutputDirectory>-->
            <PublishFolderType>Resource</PublishFolderType>
<!--            <Link>/Contents/Test123/test.txt</Link>-->
        </Content>
    </ItemGroup>

This works in Debug, but does not work in Release. No build errors, but also no test.txt in the output app bundle.

Steps to Reproduce

  1. Get test project macOSApp1.zip.
    • this is just dotnet new macos with added test.txt and it's configuration as an bundle resource.
  2. Build in debug and release: dotnet build && dotnet build -c Release
  3. Check if the test.txt is present in the ouptput: find ./bin/ -name "test.txt"

Expected: test.txt is found in both Debug and Release app bundles.
Actual: test.txt is found only in Debug

~/work/macOSApp1/macOSApp1$ find ./bin/ -name "test.txt"
./bin/Debug/net10.0-macos/osx-arm64/macOSApp1.app/Contents/Resources/test.txt

Did you find any workaround?

No response

Build logs

Release & Debug logs: binlogs.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

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions