The library hostpolicy.dll was not found

前端 未结 13 1147
自闭症患者
自闭症患者 2020-11-30 08:28

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

13条回答
  •  攒了一身酷
    2020-11-30 08:58

    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.

提交回复
热议问题