Skip to content

Compression support for single-file publish #44569

Description

@Genbox

As mentioned in the original single-file issue and in bottom of the single-file design doc, compression is something that is worth taking a look at.

A lot of applications would benefit from smaller executables. Not only is the user experience better as a smaller file means smaller download time, but it also benefits the data transfer costs.

Trimming has helped a lot, and the new .NET 5.0 single-file publish is a great improvement on what we had in .NET Core 3.1. However, a simple Hello World application is still 19 MB as a single-file executable. If I compress it with 7Z LZMA it is 6 MB.

A first step could be to implement deflate compression in the GenerateBundle Msbuild step, and then have the host decompress it in a streaming fashion from the bundle directly. This would incur a small overhead in startup time, so maybe it should have a switch - something like /p:SingleFileCompression=true.

It would be nice to have the compression algorithm pluggable, so if we ever get to have LZMA (see #1542), we can get even better compression ratio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions