Recently, I needed to run a set of applications targeting ASP.NET Core 3.1 inside .NET 9 containers. I know, it’s just a couple of days before .NET Conf 2025, and .NET Core 3.1 feels ancient at this point. But unfortunately, upgrading the applications to a newer .NET version wasn’t an option.
Had a bit of trouble getting things to run locally as well as in Azure DevOps Pipelines, so thought of sharing the experience.
First to get the things started, installed ASP.NET Core 3.1 Runtime.
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
EXPOSE 8080 2222
RUN apt-get update && apt-get install -y \
curl
# Install ASP.NET Core 3.1 runtime
RUN curl -SL --output aspnetcore-runtime-3.1.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/3.1.32/aspnetcore-runtime-3.1.32-linux-x64.tar.gz \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore-runtime-3.1.tar.gz -C /usr/share/dotnet \
&& rm aspnetcore-runtime-3.1.tar.gz
Now ran the application on this and was expecting more errors. As expected container didn't even start.
The first error I got it related to ICU.
Process terminated.
Couldn't find a valid ICU package installed on the system.
Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
I wanted to use Globalization, so installed the ICU package. Note: .NET Core 3.1 requires a specific version: libicu67.
RUN apt-get update && apt-get install -y \
curl \
wget
# Download and install libicu67 from Debian Bullseye
RUN wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu67_67.1-7_amd64.deb \
&& dpkg -i libicu67_67.1-7_amd64.deb \
&& rm libicu67_67.1-7_amd64.deb
Once that is installed, the next error is related to libssl.
No usable version of libssl was found
So installed that.
# Download and install libicu67 and libssl1.1 from Debian Bullseye
RUN wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu67_67.1-7_amd64.deb \
&& curl -fsSL http://ftp.us.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_amd64.deb -o /tmp/libssl1.1.deb \
&& dpkg -i libicu67_67.1-7_amd64.deb \
&& dpkg -i /tmp/libssl1.1.deb \
&& rm libicu67_67.1-7_amd64.deb /tmp/libssl1.1.deb
And finally got a container up and running locally.
Next is to update the DevOps pipeline. In the pipeline, we were also running EF Core migrations.
We were using ubuntu-latest agent, and installed NET Core SDK 3.1.x and dotnet-ef tool version 3.1.x.
- task: UseDotNet@2
displayName: Install .NET Core SDK 3.1.x
inputs:
version: 3.1.200
- script: |
dotnet tool install --global dotnet-ef --version 3.1.32 || dotnet tool update --global dotnet-ef --version 3.1.32
displayName: Install dotnet-ef tool version 3.1.x
And when the installing dotnet-ef --version 3.1.32, got the following error again.
No usable version of libssl was found
So installed libssl in the build agent before installing .NET.
# Ubuntu latest does not have libssl1.1 installed by default, which is required for .NET Core 3.1
- script: |
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
sudo apt-get update
sudo apt-get install -y libssl1.1
displayName: 'Install libssl1.1 for .NET Core 3.1
And now migrations were executed and an image got built, pushed and deployed.
That was quite a pain.
Hope this helps.
Happy Coding.