Support for PublishSingleFile #61

Open
opened 2026-01-29 16:28:22 +00:00 by claunia · 2 comments
Owner

Originally created by @alexrp on GitHub (Jul 7, 2019).

With .NET Core 3.0+, I can do dotnet publish -r linux-x64 /p:PublishSingleFile=true to get a single, self-contained executable (details). In this case, I only want the packaged archive to contain that executable. So it would be nice if I could say something like dotnet-zip -f netcoreapp3.0 -r linux-x64 --single-file to get that effect. Today, dotnet-zip will include everything in bin/Debug/linux-x64, including that single executable, which is of course quite wasteful.

If you're wondering why I would even want to archive the single executable, the reason is that it's not particularly well compressed:

$ ls -lh bin/Debug/linux-x64/publish/test-exe
-rwxr--r-- 1 alexrp alexrp 36M Jul  7 07:01 bin/Debug/linux-x64/publish/test-exe
$ zip test-exe.zip bin/Debug/linux-x64/publish/test-exe
updating: bin/Debug/linux-x64/publish/test-exe (deflated 65%)
$ ls -lh test-exe.zip
-rw-rw-rw- 1 alexrp alexrp 13M Jul  7 07:11 test-exe.zip
Originally created by @alexrp on GitHub (Jul 7, 2019). With .NET Core 3.0+, I can do `dotnet publish -r linux-x64 /p:PublishSingleFile=true` to get a single, self-contained executable ([details](https://devblogs.microsoft.com/dotnet/announcing-net-core-3-0-preview-5/)). In this case, I only want the packaged archive to contain that executable. So it would be nice if I could say something like `dotnet-zip -f netcoreapp3.0 -r linux-x64 --single-file` to get that effect. Today, `dotnet-zip` will include everything in `bin/Debug/linux-x64`, including that single executable, which is of course quite wasteful. If you're wondering why I would even want to archive the single executable, the reason is that it's not particularly well compressed: ```bash $ ls -lh bin/Debug/linux-x64/publish/test-exe -rwxr--r-- 1 alexrp alexrp 36M Jul 7 07:01 bin/Debug/linux-x64/publish/test-exe $ zip test-exe.zip bin/Debug/linux-x64/publish/test-exe updating: bin/Debug/linux-x64/publish/test-exe (deflated 65%) $ ls -lh test-exe.zip -rw-rw-rw- 1 alexrp alexrp 13M Jul 7 07:11 test-exe.zip ```
Author
Owner

@claunia commented on GitHub (Jul 7, 2019):

I find an even bigger reason. See #110

@claunia commented on GitHub (Jul 7, 2019): I find an even bigger reason. See #110
Author
Owner

@franklupo commented on GitHub (Feb 26, 2020):

News?

Best regards

@franklupo commented on GitHub (Feb 26, 2020): News? Best regards
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#61