I have a question that I'm very confused about. The way I understand .NET is like this:
- C# Application (source code) ->
csc.exe(compiler) ->- .NET application (which is in MSIL)
If so, why is the output from building a .NET app a Windows executable? I thought the whole idea was that your source code compiles down to MSIL, which targets the locally installed CLR. However, both .NET Core and .NET 5 generate a windows executable, which run atop of the operating system, not in a virtual machine.
This is unlike Java, which compiles to a .class bytecode file (not an .exe), and those files do run atop a virtual machine (or, later, you can package all the class files into a .jar).
What I'm trying to ask is: Why doesn't the C# compiler generate a specific application file type that runs atop .NET? E.g., a .net file that is associated with the common language runtime?
My best guess is that the Windows .exe generated is not, in fact, a Windows executable, but instead some kind of .NET executable. But, in that case, why can't it run on any platform with .NET Core? Linux doesn't know what an .exe file is.