Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the size of published executable is much larger on Linux than Windows #111299

Closed
laolarou726 opened this issue Jan 11, 2025 · 2 comments
Closed

Comments

@laolarou726
Copy link

Description

I noticed that when I use Linux to publish my self-contained app, the size of the output is much larger than the output built on the Windows machine.

  • On Linux: 52325 KB
  • On Windows: 27746 KB

Reproduction Steps

  • Publish Command: dotnet publish -c Release -p:RuntimeIdentifier=win-x64
  • Project.csproj:
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
        <PublishSingleFile>true</PublishSingleFile>
        <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
        <TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
        <UseSystemResourceKeys>true</UseSystemResourceKeys>
        <DebuggerSupport>false</DebuggerSupport>
        <DebugSymbols>False</DebugSymbols>
        <DebugType>None</DebugType>
        <SelfContained>true</SelfContained>
        <PublishTrimmed>true</PublishTrimmed>
        <TrimMode>partial</TrimMode>
        <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
        <EnableAotAnalyzer>false</EnableAotAnalyzer>
        <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
        <TrimmerSingleWarn>true</TrimmerSingleWarn>
</PropertyGroup>

...

<PropertyGroup>
        <TargetFramework>net9.0</TargetFramework>
        <Nullable>enable</Nullable>
        <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
        <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expected behavior

The size should close to each other.

Actual behavior

  • On Linux: 52325 KB
  • On Windows: 27746 KB

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 11, 2025
Copy link
Contributor

Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov
See info in area-owners.md if you want to be subscribed.

@laolarou726
Copy link
Author

I noticed when I set <EnableCompressionInSingleFile>false</EnableCompressionInSingleFile> on Windows.
DotNet will produce an executable with a size (56833 KB) really close to the Linux one.

Is this a potential bug for the compression on Linux?

@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

1 participant