-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Area-CLIbreaking-changeUsing this label will notify dotnet/compat and trigger a request to file a compat bugUsing this label will notify dotnet/compat and trigger a request to file a compat buggood first issueIssues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.Issues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.needs-breaking-change-doc-created
Milestone
Description
I'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.
nagilson
Metadata
Metadata
Assignees
Labels
Area-CLIbreaking-changeUsing this label will notify dotnet/compat and trigger a request to file a compat bugUsing this label will notify dotnet/compat and trigger a request to file a compat buggood first issueIssues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.Issues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.needs-breaking-change-doc-created