-
-
Notifications
You must be signed in to change notification settings - Fork 767
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched issues to ensure it has not already been reported
Cake runner
Cake .NET Tool
Cake version
6.0.0
Operating system
Windows
Operating system architecture
x64
CI Server
No response
What are you seeing?
According to the sources mentioned below and this comment we should be using --no-self-contained instead of --self-contained false to publish framework-dependent applications.
--self-contained falsehas no impact - the--self-containedoption, while accepting a boolean, only ever sets theSelfContainedMSbuild property totrue. you want--no-self-containedto disable self-contained builds.
In the official dotnet publish docs, the --self-contained false argument has been mentioned only once (just in the examples) and it's usage seems discouraged.
See Also:
- dotnet.exe version 10 ignores the flag --self-contained false and builds the self-contained executable if the option p:PublishSingleFile=true is set dotnet/sdk#51888
- Visual Studio Publish produces much smaller framework-dependent single-file exe than dotnet publish with identical settings dotnet/sdk#52298
- https://joefinapps.com/2025/12/26/are-your-net-10-framework-dependent-not-self-contained-exes-5x-larger-than-they-were-on-net-9/
What is expected?
The --self-contained and --no-self-contained arguments should be used.
Steps to Reproduce
- Run the following task:
var configuration = Argument("configuration", "Release");
var runtime = Argument("app-runtime", "win-x64");
var selfContained = Argument<bool>("app-self-contained", false);
Task("Publish")
.Does(() =>
{
DotNetPublish("./Source/Project.csproj", new DotNetPublishSettings
{
NoRestore = true,
OutputDirectory = "./Setup/Files",
Configuration = configuration,
Runtime = runtime,
SelfContained = selfContained,
});
});
Output log
Executing task: Publish
Resolved tool to path C:/Program Files/dotnet/dotnet.exe
Executing: "C:/Program Files/dotnet/dotnet.exe" publish "./Source/Project.csproj" --output "F:/<omitted>/Setup/Files" --runtime win-x64 --configuration Release --no-restore --self-contained false
Reactions are currently unavailable