'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:
- 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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Taki7o7 |