Skip to content

Visual Studio Publish produces much smaller framework-dependent single-file exe than dotnet publish with identical settings #52298

@ExoticGamerrrYT

Description

@ExoticGamerrrYT

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions