-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
I’m seeing a significant difference in output size between Visual Studio Publish (GUI) and dotnet publish (CLI), even when using what appear to be identical settings.
Project:
- .NET console application
- Target Framework: net10.0
- OS: Windows (win-x64)
Visual Studio Publish settings:
- Configuration: Release
- Deployment mode: Framework-dependent
- Target runtime: win-x64
- Produce single file: enabled
- Enable ReadyToRun: enabled
Result:
- Visual Studio produces a single executable of ~200 KB
- The app runs correctly and requires the .NET runtime to be installed
CLI / PowerShell command:
dotnet publish SpotifyUpdateBlocker.csproj `
-c Release `
-r win-x64 `
--self-contained false `
/p:PublishSingleFile=true `
/p:PublishReadyToRun=true `
/p:TargetFramework=net10.0
Result:
- The generated single-file executable is ~80 MB
Question:
Why does Visual Studio Publish produce a much smaller framework-dependent single-file executable than the CLI, even with the same visible options enabled?
Is Visual Studio applying additional internal MSBuild properties or a different publish pipeline that is not accessible via dotnet publish?
If so:
- Is this behavior documented anywhere?
- Is there a supported way to reproduce the Visual Studio publish output from the CLI (for CI / automation scenarios)?
At the moment it seems impossible to achieve identical output size and behavior outside of Visual Studio, which makes builds non-reproducible between GUI and CLI.
MadWizardDE