-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Doing the following steps:
dotnet new consoledotnet publish -p:PublishTrimmed=true
Results in the following error:
C:\Users\eerhardt\.nuget\packages\microsoft.net.illink.tasks\8.0.100-1.22619.1\build\Microsoft.NET.ILLink.targets(196,5): error NETSDK1102: Optimizing assemblies for size is not supported for
the selected publish configuration. Please ensure that you are publishing a self-contained app. [C:\DotNetTest\Net8Console\Net8Console.csproj]
However, doing
dotnet publish -p:PublishAot=true- -or-
dotnet publish -p:PublishSingleFile=true
Just works without more command line args.
We should make PublishTrimmed=true imply SelfContained=true, just like PublishAot=true and PublishSingleFile=true does. That way users don't need to pass extra args on the command line, just to make this work.
If in the future we want to support a mode where PublishTrimmed=true, but SelfContained=false, those customers can explicitly --self-contained false. This is consistent with the current PublishSingleFile=true behavior. By default it is self-contained. And you can opt into Framework Dependent Deployment with dotnet publish -p:PublishSingleFile=true --self-contained false.
nagilson and DamianEdwards