GithubHelp home page GithubHelp logo

publishaotcompressed's Introduction

PublishAotCompressed

This is a NuGet package with an MSBuild target to compress results of PublishAot with UPX. Simply add a reference to this package and publish with PublishAot as usual. The result of AOT compilation will be compressed. UPX typically achieves 60% or more size savings. To achieve even more compression at the cost of startup time, specify <PublishLzmaCompressed>true</PublishLzmaCompressed> property as well.

UPX will in-memory decompress the program at launch. This is typically not observable.

A Hello World style program with <UseSystemResourceKeys>true</UseSystemResourceKeys> and <InvariantGlobalization>true</InvariantGlobalization> (two documented size savings options that pretty much everyone should enable) compressed with UPX is around 830 kB in size, fully self-contained. (On Linux, don't forget to also set <StripSymbols>true</StripSymbols>, the documented switch to place debugging symbols into a separate file.)

publishaotcompressed's People

Contributors

kevingosse avatar michalstrehovsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

publishaotcompressed's Issues

linux-arm64 support

Hi,

I see there is only support for x86_64 for both Windows and Linux. Would it be possible to add linux-arm64?

When I tried to manually download binary for arm64 from https://github.com/upx/upx/releases/tag/v3.96 and placed it into
.nuget/packages/publishaotcompressed/0.0.3/tools, publish of "Hello world" app was successful, but after running, I got
segfault

linux-musl-x64 is support

I noticed that there are only linux-x64 and win-x64 in the tools directory, which makes me think that linux musl-x64 is not supported.

But after my actual test, I'm glad that it can work normally in the linux-musl-x64 (mcr.microsoft.com/dotnet/sdk:7.0.100-alpine3.16-amd64) environment. :) ๐Ÿ‘ ๐Ÿ’ฏ

Can you update the README.md file to let more people know this?

Finally, thank you for your great contribution !!! ๐Ÿฅ‡ ๐Ÿฅ‡ ๐Ÿฅ‡

Support whitespace in nuget package path

MSBuild will fail when the nuget packages are cached in a path that contains whitespaces. This can be fixed by adding &quot; to the exec statement.

Replace this line

<Exec Command="$(MSBuildThisFileDirectory)../tools/$(_OSIdentifier)-$(_OSHostArch)/upx $(_UpxArgs) $(NativeBinary)" />

with

<Exec Command="&quot;$(MSBuildThisFileDirectory)../tools/$(_OSIdentifier)-$(_OSHostArch)/upx&quot; $(_UpxArgs) $(NativeBinary)" />

Error code 127 on Linux when LZMA compression is enabled

After publishing a NativeAOT app with UPX and PublishLzmaCompressed, it randomly crashes at startup with an error code 127. I've seen it happening about 1 times out of 1000 on Alpine, and less frequently on other distributions.

UPX is definitely the culprit. I don't know if it's an UPX issue affecting all applications (hadolint/hadolint#475 looks related, there's also upx/upx#385 but it's supposedly fixed) or a weird interaction with NativeAOT. I'm mostly opening this issue for awareness.

I haven't been able to reproduce the issue with a simple Hello World. I assume that the issue is dependent on the size of the app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.