Publishing .net core 5.0 into single exe file

Viewed 3795

Can anybody help me. I'm trying to publish my .net core console app into single file.

I'm using this command:

dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true

I'm expecting that it will create a single file. But still there's dll files:

clrcompression.dll
clrjit.dll
coreclr.dll
mscordaccore.dll

How I can fix it? I already search but that's the same result

4 Answers

If using visual studio, go Build-> Publish [yourprojectname], edit the profile and check Produce single file.

enter image description here

I also had the same problem but I found the answer by exploring the dotnet publish help menu. Use the following command dotnet publish -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true this will embed the .dlls in the binary therefore in the publish folder will remain only a .pdb file which isn't necessary during runtime.

Related