Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building an app with PublishTrimmed trims too much #27069

Closed
lechgu opened this issue Dec 28, 2021 · 1 comment
Closed

building an app with PublishTrimmed trims too much #27069

lechgu opened this issue Dec 28, 2021 · 1 comment

Comments

@lechgu
Copy link

lechgu commented Dec 28, 2021

I have an asp.net core app with ef core.
The app uses PublishTrimmed=true and it causes the app fail in runtime with error coming from the sql translator that
"Round not found on Math".
The app runs in the docker container on Azure Kubernetes Service.
Removing PublishTrimmed=true seems to be a workaround but it make the image larger, so it would be good if this is fixed.

The packages used with the versions:

<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="dotenv.net" Version="3.1.1" />
<PackageReference Include="Grpc.AspNetCore" Version="2.41.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.41.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  <PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.Identity.Web" Version="1.21.1" />

The Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app

COPY Service/ ./Service
COPY protos/ ./protos

RUN dotnet publish Service -c release --self-contained -r linux-musl-x64 -p:PublishSingleFile=true -p:PublishReadyToRun=true -p:PublishTrimmed=true

FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine
RUN apk add --no-cache icu-libs
COPY --from=build /app/Service/bin/release/net6.0/linux-musl-x64/publish/Service /usr/local/bin/identity

ENV PORT=80
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV Logging__LogLevel__Microsoft=Information

CMD [ "identity" ]

@roji
Copy link
Member

roji commented Dec 28, 2021

Duplicate of #26288

@roji roji marked this as a duplicate of #26288 Dec 28, 2021
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants