What is a way I can a native EXE using C#, I want to compile a basic EXE which will run without the need for the .net framework. I've heard of ngen.exe can anyone give me examples of ngen.exe or any better ways. Also I will have a runtime for the application being generated how can I place it into the application so anybody who is using my language can use its features.
Asked
Active
Viewed 1,139 times
6
-
C++ or Delphi, Delphi would be close but you have to try and code without using .NET libraries – Sandeep Bansal Oct 21 '11 at 15:58
-
can Delphi compile a executable? – Steven Oct 21 '11 at 16:01
-
Yes, Delphi can compile an executable. – Darin Dimitrov Oct 21 '11 at 16:07
-
Here's a question about this very problem as of 2009: http://stackoverflow.com/questions/668188/the-state-of-linkers-for-net-apps-aka-please-sir-may-i-have-a-linker-2009-e – Robert P Oct 21 '11 at 16:21
-
Essentially...take a look at what Mono can do for you. It's about as close as you can get. – Robert P Oct 21 '11 at 16:22
-
Perhaps the question should be posed "Is it possible to package a C# executable and runtime so that it can run without having to install the runtime?". – Damon8or Oct 21 '11 at 16:46
1 Answers
7
Can't do that. Anything written with C# will require the .NET framework to be installed on the machine in which it runs. NGEN is just an optimization; it does not remove the need for the framework.
To do this you'll need C++ or some other language that does not require a runtime.

kprobst
- 16,165
- 5
- 32
- 53
-
This statement is not strictly true "Anything written with C# will require the .NET framework to be installed on the machine in which it runs." This is only true of the MS implementation – Conrad Frix Oct 21 '11 at 16:14
-
2
-
You forgot MonoTouch and Unity3d. Also there's nothing stopping you from writing a C# compiler that doesn't require any framework. These of course are all quibbles since its clear that the OP is targeting windows and using the MS Compiler – Conrad Frix Oct 21 '11 at 16:26
-
-
@Steven as far as I know not for windows and not right now unless you include http://llvmsharp.codeplex.com/ which is in Alpha. But who knows maybe someone wrote one and just isn't sharing. Proving Non-Existence is tricky – Conrad Frix Oct 21 '11 at 16:32