[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How does Debian know how to execute my .NET programs even if I don't specify mono?

I have a program compiled with mcs meant for mono called: hello.exe.
If I just do ./hello.exe it runs automatically. How does it happen?
why do I not have to do mono hello.exe. Why does it run only with

 I mean Linux wouldn't execute a code unless it knows the interpreter
from the she-bang line or it is an ELF32 file. but my hello.exe is
neither ELF file nor does it have a shebang line on the top. how then
Linux understands that it must be executed with mono?

Outputs from my console:

(hello.exe is a C# program compiled using mcs. nc.exe is Netcat for
windows. nc.exe is not a C# or .NET program)

fossist@debian:~/lab/c$ ls -l nc.exe hello.exe
-rwxr-xr-x 1 fossist fossist  3072 Feb 23 01:42 hello.exe
-rwxr-xr-x 1 fossist fossist 61440 Dec 29  2004 nc.exe

fossist@debian:~/lab/c$ file nc.exe hello.exe
nc.exe:    PE32 executable for MS Windows (console) Intel 80386 32-bit
hello.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
Mono/.Net assembly

fossist@debian:~/lab/c$ ./nc.exe; ./hello.exe
run-detectors: unable to find an interpreter for ./nc.exe
Hello World!

Reply to: