Aspnetcore: aspnet.core 3.1 application does not use satellite assembly resources like localization of referenced libraries in Linux or docker container

Created on 9 Jan 2020  路  2Comments  路  Source: dotnet/aspnetcore

aspnet.core 3.1 application does not use satellite assembly resources like localization of dependent libraries in Linux or docker container

I use the aspnet.core sample and reference a dotnet standard 2.1 library with existing satellite assemblies for localization.

Then I run the aspnet.core app and it works with localization in Windows 10 as expected.
In Ubuntu 18.04 and Docker Runtime 3.1 the localization does not work for the referenced library and its satellite assemblies.

General

tested/affected operating system:
Windows with IIS Express - works as expected / localized assemblies are used
Ubuntu 18.04 with Kestrel - localized assemblies are not used
Dotnet Core Docker Container 3.1 with Kestrel from mcr.microsoft.com/dotnet/core/aspnet:3.1 - localized assemblies are not used

Source Directory Structure

./Runtime
./Topography --> .Net Standard Library with satellite assemblies
./aspnetapp --> ASP.NET Core Sample

Runtime Directory Structure

./aspnetapp.dll
./aspnetapp.Views.dll
./Czm.Biometry.Topography.Core.dll
./Czm.Biometry.Topography.Gui.dll
./Czm.Biometry.Topography.Interfaces.dll
./Czm.Biometry.Utilities.Core.dll
./Czm.Biometry.Utilities.Interfaces.dll
./de-DE/Czm.Biometry.Topography.Gui.resources.dll
./fr-FR/Czm.Biometry.Topography.Gui.resources.dll
./System.Drawing.Common.dll

Build steps Windows 10 with Visual Studio 2019

Run aspnetapp Solution

Build steps Ubuntu 18.04

dotnet build in aspnetapp directory
dotnet aspnetapp.dll in Runtime directory

Docker File

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

# copy csproj and restore as distinct layers
COPY aspnetapp/*.sln .
COPY aspnetapp/aspnetapp/*.csproj ./aspnetapp/
COPY Topography/* ./Topography/
RUN dotnet restore

# copy everything else and build app
COPY aspnetapp/aspnetapp/. ./aspnetapp/
COPY ./Topography/. ./Topography/
COPY aspnetapp/CodeAnalyzers/ ./CodeAnalyzers/

WORKDIR /app/aspnetapp
RUN dotnet publish -c Debug -o out


FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
# install libgdiplus for System.Drawing
RUN apt-get update && \
    apt-get install -y --allow-unauthenticated libgdiplus libc6-dev

# install x11 for System.Drawing
RUN apt-get update && \
    apt-get install -y --allow-unauthenticated libx11-dev

#debugging
RUN apt update && \
    apt install unzip && \
    curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l /vsdbg
RUN apt-get update && \
    apt-get install -y --allow-unauthenticated procps

#install localization
RUN apt update && \
    apt-get install -y --allow-unauthenticated locales
RUN sed -i -e 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
    sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
    locale-gen
ENV LANG de_DE  
ENV LANGUAGE de_DE  
ENV LC_ALL de_DE 

# Disable the invariant mode (set in base image)
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

WORKDIR /aspnetapp
COPY aspnetapp/intel/*.* ./intel/
ENV LD_LIBRARY_PATH=./intel:$LD_LIBRARY_PATH

COPY --from=build /app/aspnetapp/out ./
COPY ./Topography/de-DE/ ./de-DE/
COPY ./Topography/fr-FR/ ./fr-FR/

#ENTRYPOINT ["dotnet", "aspnetapp.dll"]
affected-medium area-mvc bug severity-major

Most helpful comment

Help is really appreciated, since most descriptions about ASP.Net Core Localization only describe the Web Application Code and do not give any details about localization of referenced libraries:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1
https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/

Also a best practice for cross-platform localization of .Net Standard libraries is really appreciated, if anyone can provide this information.

All 2 comments

Thanks for contacting us.
We'll look into what's causing this and get back to you.

Help is really appreciated, since most descriptions about ASP.Net Core Localization only describe the Web Application Code and do not give any details about localization of referenced libraries:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1
https://docs.microsoft.com/en-us/dotnet/standard/globalization-localization/

Also a best practice for cross-platform localization of .Net Standard libraries is really appreciated, if anyone can provide this information.

Was this page helpful?
0 / 5 - 0 ratings