Can you compile C# so it doesn't need the .NET Framework at runtime?


Answers

Look at mkbundle using Mono.

Question

Is it possible to force the C# compiler to pull all the referenced calls out of the framework and pack them into dlls or even a single executable?

I like writing quick 'one-off' applications with C#, however I don't want to have to install the whole framework on the target machine once it's ready to go.




Not possible. Your "compiled" C# application is a language which the .Net CLR interprets (should have said JITed, Reads the IL, compiles to native code, and then invokes the compiled native code) at runtime.

FYI .net 2.0 is a standard install on xp SP2 and vista, so you won't be paying that much of a penalty.

You could look into mono, but this still involves running some kind of framework on your target machine.




Some C# features are bound to interfaces of the .NET framework.

For example:

yield return requires the IEnumerable interface

using (x) {} requires the IDisposable interface







Links



Tags

c# c#   .net .net