none
Use a .NET language (VB.NET or C#) without requiring .NET to be installed? RRS feed

  • Question

  • I doubt major programs like Firefox or Photoshop use .NET, so they must compile their programs into native code, right? A lot of articles about .NET make it sound like you have to use a CLR (that would be managed code, right?), otherwise your program won't run on all machines, but that doesn't seem to be the case. But then what do those programs use? Unmanaged code?

    Is there any way to use a .NET language (VB.NET or C#) without requiring .NET to be installed on the target machine? Is there any way to convert a .NET assembly into native code (like "normal" programs)? And what would be the drawbacks of this, if possible?

    Basically, I'd like to keep using VB.NET or C#, but compile into native code that can run without requiring the .NET framework. If possible, I'd also like to a) keep using Visual Studio, and b) still be able to use the .NET libraries.


    Thanks,
    Grant
    Saturday, September 11, 2010 5:58 PM

Answers

  • For most people the practical answer is no (there are a few 3rd party products that offer this capability - but, the couple I've looked at have been pretty expensive).  You can't run a .NET program on a machine that does not have the CLR installed.  So, if that is a problem for you, then you shouldn't be using a .NET language.

    That said, the clr is a part of the default installation of windows since Vista and w2k8.  Version 2.0 is on a pretty sizable percentage of XP machines - and once installed it is kept updated by windows update.  So, if your developing software for mass consumption, targeting the 2.0 run time gives you a pretty sizable base that already has it installed.  And for the others, you can always include the .net bootstrapper in your install package, to make sure it is downloaded and installed with your software.

    If those requirements are not acceptable, and you must develop dependency free software, then you will need to look at alternatives, such as C++, Delphi, or PowerBasic...


    Tom Shelton
    • Marked as answer by grantman16 Saturday, September 11, 2010 6:26 PM
    Saturday, September 11, 2010 6:17 PM

All replies

  • For most people the practical answer is no (there are a few 3rd party products that offer this capability - but, the couple I've looked at have been pretty expensive).  You can't run a .NET program on a machine that does not have the CLR installed.  So, if that is a problem for you, then you shouldn't be using a .NET language.

    That said, the clr is a part of the default installation of windows since Vista and w2k8.  Version 2.0 is on a pretty sizable percentage of XP machines - and once installed it is kept updated by windows update.  So, if your developing software for mass consumption, targeting the 2.0 run time gives you a pretty sizable base that already has it installed.  And for the others, you can always include the .net bootstrapper in your install package, to make sure it is downloaded and installed with your software.

    If those requirements are not acceptable, and you must develop dependency free software, then you will need to look at alternatives, such as C++, Delphi, or PowerBasic...


    Tom Shelton
    • Marked as answer by grantman16 Saturday, September 11, 2010 6:26 PM
    Saturday, September 11, 2010 6:17 PM
  • Those programs in most case probably use c++...

    Many application is now develop with .net and need the framework to be installed prior... framework can be installed by your application msi if not present also...

    You cant use vb.net or c# without framework... but... .net framework is installed everywhere (windows update install them) so i would really not consider this as an issue in most case....

    Otherwise you will need to use c++ or another programming language in order to be able to reach your goal....

    Saturday, September 11, 2010 6:18 PM
  • The mono project has a free open source tool that packs a .net program into a stand alone .exe that includes the basic clr and only libraies that are used by the program.

    I think is was done for .net 2.0 and hasn't been well maintained since, but that may have changed.

    You can tell vs 2010 to use an earlier version of .net. most window systems will have at least 3.0 installed.

    Users can install .net 4.0 using windows update, it will be in the option section.

    Dennis

    Wednesday, October 6, 2010 3:11 AM