The self-contained export does not work with Linux

I have tried as described in the article:

But I can’t get it to work. It says it can’t find the file. I tried self-contained compilation. Could it be because I am using Raspbian 64-bit? Or am I just doing something wrong?


I would be very grateful if there are any ideas.

any chance you could share your test?

It’s very simple, just “WriteLine”
String means nothing, just for debugging

linux_pi_gamma2 (93.0 KB)

so, even before you move files to the raspi… just looking at the export folder gives me 42 items. one if which is called “linux” ie. without file ending. that will be the file. now make sure to copy all those files over.

@joreg I can’t upload an archive larger than 8MB (on the forum), I deleted large files from the bin folder. Do you need the release files?

I’m pretty familiar with Linux, but not a power user.
I even changed the attribute to executable

so you’re saying on windows you see the file, but when copying all files over to linux, the file is no longer there?

i don’t really understand what your bash screenshot is showing. can you do a simple “ls” in the dir to show that it has the same files as you see on windows?

All files are in place. the problem is not the files.

I’m launching:

and terminal answers:
./linux: cannot execute: required file not found

the executable in place:

ls linux -l
-rwxr-xr-x 1 pi pi 48044 May  2 22:32 linux


all the files can be seen in the Windows screenshot. The composition of the files is the same. These are the same files. I hope I didn’t confuse you with the names, I just did another project called Linux. So the executables are called Linux and the folder is called Linux.

Before I built files after exporting once:
dotnet publish -c Release -r linux-arm --self-contained true /clp:ErrorsOnly /nologo "C:\Users\USER\Documents\vvvv\gamma-preview\Exports\src\linux\linux.csproj"

It looks like a file is missing when I run the file. Some file, not an executable file. I am also confused by this message.

I think I found a reason

I’ll try it and report back

update: nope, the same message

What I see online about this bug is that some nugets can cause it (or their absence)

Another interesting assumption, but I think I’m doing the right thing:


i’m testing on WSL running ubuntu:

confirmed. when trying to run a self-contained executable created with 6.2 (ie .NET8) i get “dotnet linux-arm64 cannot execute binary file: Exec format error”

and for the record when created with 5.2 (ie NET6) i get “Failed to load /home/joreg/linux/”. i had tested this to work earlier though, so not sure what’s different now.

what does work though, is using the framework dependent option, where you need to install the .NET8 runtime first.

@joreg Thank you very much, that clears it up.

It’s working for me…

Tested with 6.3 and Manjaro Linux on a Pi 4B.


Published with the following command line:
dotnet publish -c Release -r linux-arm64 --self-contained true /clp:ErrorsOnly /nologo "D:\_Patching\justforkicks\rpi-test\src\rpi\rpi.csproj"

Copied over to a smb share on the PI. Made executable with chmod +x rpi.


Attachment contains the patch and the exported source.
rpi-test.7z (5.5 KB)

Published executable via Wetransfer because of upload limit.

@bjoern Confirm! Version 6.3 works perfectly!
Thank you so much!