Skip to content

dotnet.exe version 10 ignores the flag --self-contained false and builds the self-contained executable if the option p:PublishSingleFile=true is setΒ #51888

@ymalich

Description

@ymalich

Hello
I publish an application using the command line
dotnet publish Project.csproj -o .\Publish -p:PublishReadyToRun=false -p:PublishSingleFile=true --self-contained false

It means I want to get a small single .exe but not the large self-contained .exe in the output folder.
is not defined in the .csproj

If I build using the dotnet SDK 8.0 or 9.0, I get the small sibgle exe.
But dotnet SDK 10 ignores the explicit flag --self-contained false and build the big self-contained exe.

To Reproduce

  1. create the simple Console .csproj, without Property

  2. create global.json
    {
    "sdk": {
    "version": "10.0.100",
    "rollForward": "latestFeature",
    "allowPrerelease": false
    }
    }

  3. run
    dotnet publish Project.csproj -o .\Publish -p:PublishReadyToRun=false -p:PublishSingleFile=true --self-contained false

  4. change global.json
    {
    "sdk": {
    "version": "8.0.100",
    "rollForward": "latestFeature",
    "allowPrerelease": false
    }
    }

  5. run
    dotnet publish Project.csproj -o .\Publish -p:PublishReadyToRun=false -p:PublishSingleFile=true --self-contained false

  6. compare the 2 outputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions