`-a` sets app to framework-dependent when `SelfContained` is `true`
See original GitHub issueI’m working on some samples and following the excellent guidance at https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/. The guidance doesn’t work as intended when I target SCD.
My project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishSelfContained>true</PublishSelfContained>
</PropertyGroup>
</Project>
In Dockerfile:
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -a $TARGETARCH
# copy and publish app and libraries
COPY . .
RUN dotnet publish -a $TARGETARCH -o /app
This fails.
5.453 /root/.nuget/packages/microsoft.net.illink.tasks/8.0.0-preview.6.23329.7/build/Microsoft.NET.ILLink.targets(193,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. [/source/releases.csproj]
Works if I do:
RUN dotnet publish -a $TARGETARCH -o /app --self-contained
We should fix -a
to be less strong. It should not override SelfContained
or PublishSelfContained
if set.
Issue Analytics
- State:
- Created 2 months ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Should I use self-contained or framework-dependent ...
In this post I compare the impact of the framework-dependent vs self-contained mode on Docker image size, taking layer caching into account.
Read more >NET application publishing overview
When publishing your app and creating an executable, you can publish the app as self-contained or framework-dependent. Publishing an app as self ...
Read more >Converting a Framework-Dependent App to Self ...
Below are instructions on how to change a Framework-Dependent .NET Core application to a Self-Contained one (i.e. where all the assemblies ...
Read more >.NET Core Self-Contained and Framework-Dependent ...
When you publish a .NET Core project, you can choose between two deployment modes: Framework-Dependent and Self-Contained.
Read more >Self-Contained Applications: Great Tool in .NET 8
The ultimate benefit of a self-containerized application is that it easily deploys an application to an external user. It deploys with all its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix is targeted for rc1 as its too late to fix this for the last preview now
@dotnet/illink-contrib a new issue has been filed in the ILLink area, please triage