.net-6.0.net-core-publishsinglefile

NET6 Linux-x64 Self-Contained Single-File Unusable


I've a project that runs perfectly as "Framework-Dependent Single-File" on Linux-x64, and also as a "Self-Contained" application.

But when I compile as "Self-Contained Single-File", the Visual Studio 2022 (17.1.2) creates a file without any extension (exe or dll), and I cannot run it anyway on Ubuntu 21.x.

When I call it, I always get an "invalid application" error. I tried:

Is there something I could be doing wrong?

I appreciate any help you can provide.


Solution

  • As Heretic Monkey stated, you need to run it with ./NAME

    Also you need to make sure that the user has Execute permissions for that file. See chown/chmod