I have a simple .NET Core project (console app) that I\'m trying to compile and run. dotnet build
succeeds, but I get the following error when I do dotnet
In my case it was because I was publishing a self-contained application for the wrong target. My intent was to run on alpine linux, but I was building for libc
when I should have been building for musl
.
The failing package was built using:
dotnet publish --self-contained true --runtime linux-x64 --framework netcoreapp2.1 --output /app
Changing the RID:
dotnet publish --self-contained true --runtime linux-musl-x64 --framework netcoreapp2.1 --output /app
produced a functional package. Notice the RID changed from linux-x64
to linux-musl-x64
. If I had read the .NET Core RID Catalog page this could have been avoided.