none
How to use a .NET language without requiring .NET to be installed? Use NGEN to convert CIL to native machine code, or keep using .NET as it is? RRS feed

  • Question

  • Here's what I've figured out from Wikipedia, and please correct me if I'm wrong:

    • .NET is the original and most popular CLR (although there are other implementations of it, including cross-platform versions like Mono).
    • Visual Studio creates a program containing CIL code that passes that code through the .NET CLR (if installed) to convert it to native machine code that matches the current environment, allowing the program to run on any machine that the CLR will run on (for .NET 4.0, that would be XP SP3 or greater).
    • But the cost of this portability is that the code needs to be converted every time it's run, decreasing load time.

    So, which one of these paths seems like the best way to go:

    • Keep using .NET and either packaging the framework with my installers or instructing users to install .NET 4.0 if they don't have it.
    • Convert the CIL program to machine code using ngen BEFORE distributing it, so .NET is no longer required. (Is this possible, or would the .NET libraries still need to be installed, defeating the purpose?)
    • Ditch .NET and all its wonderful libraries in favor of a language/compiler (like C++ or maybe C# with some compiler other than VS) that creates native code. (Don't want to do this, but I'm throwing it out there.)

    Is .NET the way to go? I love the libraries but I don't like that .NET needs to be installed (annoying for XP users and computers that have an earlier version).

    I know I'm covering a lot of ground with this, but I recently learned about how .NET actually works (the whole CLI, CIL, CLR thing) and now I really confused! When I stumbled across this, I was looking to see if there was a way to use a .NET language (currently VB.NET, but I'm trying to switch to C#) without needing .NET as a prerequisite. I was originally thinking about somehow compiling only the needed .NET libraries with my programs, but now I'm wondering if it's smart to use NGEN to convert my programs to native machine code before distributing, but as earlier stated, I don't know if it would still require the .NET runtime, and would it still work on all machines.


    Thanks a ton; I really hope someone can help me figure this out.

    - Grant

    Saturday, September 11, 2010 3:12 AM

Answers

  • .Net assemblies need the .Net framework in order to run...

    NGEN is use for performance issue not for portability.... And if you want to NGEN your assemblies you need to do this on the target machine... you cant redistribute the result of NGEN (NGEN dont modify source dll assemblies it create a new version on a system folder somewhere i think)

    • Marked as answer by grantman16 Saturday, September 11, 2010 5:59 PM
    Saturday, September 11, 2010 5:32 AM

All replies