dotnet / dotnet/sdk

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

Open
#51,888 7 comments 5 reactions 1 assignee Claimed by @baronfel View on GitHub
untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.