NET6 Linux-x64 Self-Contained Single-File Unusable

1.5k views Asked by At

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:

  • dotnet myproject
  • dotnet myproject.dll (adding the DLL extension manually before the call)
  • dotnet myproject.exe (adding the EXE extension manually before the call)

Is there something I could be doing wrong?

I appreciate any help you can provide.

1

There are 1 answers

0
Taki7o7 On BEST ANSWER

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