6

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.

David Hall
  • 32,624
  • 10
  • 90
  • 127
Steven
  • 109
  • 6

1 Answers1

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
    _A runtime_, regardless if it's Mono or .NET. – kprobst Oct 21 '11 at 16:20
  • 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
  • is there a implementation of C# which compiles native? – Steven 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