publish.net-5single-file

PublishSingleFile publish more than one file


I'm publishing my net 5 app with:

dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true

but, as a result I have:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        2/16/2021  10:20 PM         747896 clrcompression.dll
-a----        2/16/2021  10:20 PM        1322360 clrjit.dll
-a----        2/16/2021  10:20 PM        5153144 coreclr.dll
-a----        3/15/2021  11:48 AM       53841260 fff.exe
-a----        3/15/2021  11:48 AM          11300 fff.pdb
-a----        3/15/2021  11:48 AM            537 fff.xml
-a----        2/16/2021  10:20 PM        1056640 mscordaccore.dll

deploying just fff.exe does not work. Have to deploy dll's too. Why? Source code for reference can be found here: Fast Find in Files


Solution

  • Use this command instead

    dotnet publish -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesInSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -c release
    

    Documentation