Skip to content

dotnet publish --no-build with PublishSingleFile doesn't produce a working executable #33655

@jcberleur

Description

@jcberleur

Steps to reproduce

mkdir Main 
cd Main
dotnet new console
dotnet build -c Release -r linux-x64
dotnet publish -c Release -f netcoreapp3.1 -r linux-x64 --no-build --no-self-contained /p:PublishSingleFile=true
./bin/Release/netcoreapp3.1/linux-x64/publish/Main

Expected behavior

running the executable works normally

Actual behavior

running the executable doesn't work with the error:

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/usr/share/dotnet'.

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.102
 Commit:    573d158fea

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.102/

Host (useful for support):
  Version: 3.1.2
  Commit:  916b5cba26

.NET Core SDKs installed:
  3.1.102 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions