-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PublishSingleFile results in executble that can't decode #5409
Comments
As as addendum, copying
For what it's worth, this is the header for the project file, I think the settings are all fine
|
Success! - here is a standlone simple reproIn an empty folder (e.g. tmp) run
Publish as a singlefile, self contained binary
Copy the "standalone binary" into a new test folder
Here is the full transcript in git bash
And for reference, installed versions
|
Final comment - I went back to 3.1.403 to get this shipped to customer and the publish folder contains just an exe file, whereas publishing with RC2 was leaving the extra dlls separate, so I assumed RC2 somehow isn't taking the singlefile part seriously and leaving some dlls outside the package. |
In .NET 5 the single-file publish may produce more than one file and it's by design. See the expected behavior described here: https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience In 3.1 single-file is basically just a self-extracting executable - it writes everything into temp and runs from there. As such for the running app nothing really changes (everything is a file, with a path and so on). In 5 we don't write to disk by default, all managed assemblies are loaded directly from the executable. The problem is native libraries - it's technically VERY difficult to include a random .dll in an executable and run it from the executable directly. There are other reasons (like debugger support on Windows). For these reasons we leave some of the native libraries outside of the executable. On Linux we were able to get to just the executable for simple cases, on Windows we need several files next to the exe. If you only take the .exe and run it, it won't work - it needs those additional files. If you need .NET 5 but want the self-extracting behavior you can set There's also a "hybrid" mode |
Thanks - appreciate the explanation. Did this change between RC1 and RC2? I swear we successfully deployed a single file executable off RC1 a couple of weeks ago. The whole single file experience has been pretty bumpy. It's super useful - we support a lot of users who want a simple artifact they can download or copy use (and that means an actual single file single file). We were burned by the older 3.1 extracted folders getting half cleaned up and not regenerating, switched to 5.0RC1 to get around that problem and ran into a bug with trimmed executable, switched that feature off and were good for a few weeks with 5.0.RC1 then upgraded to RC2 to stay current and single file now means multiple files. I understand the technical challenges doing a true single file and appreciate the pointer on docs - I think we can make this work. I guess we will have to decide if we want the self extraction or the multi file single file experience (or ask our users). Both are problematic - It is nice to be able to pick your poison. PublishSingleFile is not true though :( |
I know the name of the feature is wrong (it's actually unlikely we will ever be able to do true single-file for all apps, without extraction, it's just too hard) - unfortunately we're stuck with it (renaming would be even worse I think). We did fix quite a few issues around the self-extract in 3.1.4 - try to get the latest 3.1 SDK and rebuild your app with it. It's not perfect, but it's better. One important thing we did was to check all of the files are present every time the app starts - so if something half-deleted the app, starting it again will "Fix it". For 6.0 we hope we will be able to do a true 1 file even on Windows - at least for basic apps - dotnet/runtime#43071 For future issues with single-file - can you please create the issues in the dotnet/runtime repo? (We should be much faster responding there). |
Thanks! - will do and appreciate the thoughtful replies. I understand the challenges. The "singe file" support in the 3 series has been really useful for shipping artifacts to customers, even with all the imperfections. Thanks for all the hard work. |
Issue Title
A binary that previously published happily in 5.0-R1 now publishes a binary that can't decompress. I am moderately confident that it's a behaviour change between RC1 and RC2 (see later comments - I did manage to get a hello world reproduction of the problem)
General
we are using single file publishing to produce an executable from an F# .net core app that is consumed by the end user as a standalone executable. We were using 3.1.200 series but ran into problems with the temporary files getting deleted and so started using the 5.0 series which has this problem fixed. RC1 was successfully building a binary ( with the caveat that we had to switch off trimmed executables due to another separate bug). The most recent attempt to build a standalone binarysucceeds but when run, the binary reports it seems to be missing
clrcompression.dll
, which I can see in the publication directory, but I'm assuming should be also inside the single file executable.I have unfortunately uninstalled RC-1 but could also go back and be hundred percent sure it's just the change in the RC2 that is causing this.
The text was updated successfully, but these errors were encountered: