Home All Groups Group Topic Archive Search About

Making an exe that doesn't need .NET framework

Author
11 Jun 2009 12:39 PM
ofiras
Hi,
I never understood how can it be that most programs don't ask me to
install .NET, although I know that many companies use C#. Is there any
way to make an exe of a C# program that doesn't need .NET to be
installed? If so, how can I do it?
Thanks,
Ofir.

Author
11 Jun 2009 1:29 PM
Mark Rae [MVP]
"ofiras" <ofi***@gmail.com> wrote in message
news:163be675-17bd-4357-a440-25395e56a5d4@w40g2000yqd.googlegroups.com...

> I never understood how can it be that most programs don't ask me to
> install .NET

Because the .NET Framework is already installed on the vast majority of PCs
running either XP or Vista...


> Is there any way to make an exe of a C# program that doesn't need .NET to
> be
> installed?

Yes.


> If so, how can I do it?

http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=.NET+without+framework


IMO, this is a complete waste of time and money...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Are all your drivers up to date? click for free checkup

Author
11 Jun 2009 1:44 PM
Larry Smith
> I never understood how can it be that most programs don't ask me to
> install .NET, although I know that many companies use C#. Is there any
> way to make an exe of a C# program that doesn't need .NET to be
> installed? If so, how can I do it?

You (effectively) can't. While C# is a generic language and doesn't
technically require .NET, it does require a host platform that provides the
same functionality. You can read about this in the official C# standard and
other sources. Search for ISO/IEC 23270, "CLI, "CLR", "CLS", etc. For all
intents and purposes however .NET is really the only game in town (on
Windows anyway - you can read about the Mono project and others however). If
an installation program isn't asking you to install it then it either
assumes it's already installed (very good chance these days), will be
installed (manually), or it's specifically checking that it's installed
(note BTW that it's shipped with the latest MSFT OSs but may not be
installed by default - it can be installed using the "control panel"
however). In any case, you can't run your program without it, even if you
find "tricks" that rely on it indirectly. You might find "ngen.exe"
interesting for instance but all this does is JIT-compile your code up
front.
Author
11 Jun 2009 1:50 PM
Mark Rae [MVP]
"Larry Smith" <_nospam@_no_spam.com> wrote in message
news:eJVAKrp6JHA.1372@TK2MSFTNGP05.phx.gbl...

>> Is there any way to make an exe of a C# program that doesn't need .NET
>
> You (effectively) can't.

http://www.xenocode.com/Products/Postbuild-for-NET/?gclid=CNLlyt2tgpsCFZQU4wod1GPVsg

Why you would want to, though, is another question...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Author
11 Jun 2009 2:36 PM
Larry Smith
>>> Is there any way to make an exe of a C# program that doesn't need .NET
>>
>> You (effectively) can't.
>
> http://www.xenocode.com/Products/Postbuild-for-NET/?gclid=CNLlyt2tgpsCFZQU4wod1GPVsg
>
> Why you would want to, though, is another question...

You wouldn't. Hence the reason I used the word "effectively" (perhaps a poor
choice of words). While it technically can be done using a 3rd-party product
like the one you cited (compiling your managed app into native code ahead of
time), this is no longer a .NET app on the client's machine anymore (which
is what the op was presumably asking about). It's also risky IMO so I agree
with your original comment. It's a "complete waste of time and money".
Author
11 Jun 2009 2:58 PM
ofiras
Show quote Hide quote
On 11 יוני, 15:44, "Larry Smith" <_nospam@_no_spam.com> wrote:
> > I never understood how can it be that most programs don't ask me to
> > install .NET, although I know that many companies use C#. Is there any
> > way to make an exe of a C# program that doesn't need .NET to be
> > installed? If so, how can I do it?
>
> You (effectively) can't. While C# is a generic language and doesn't
> technically require .NET, it does require a host platform that provides the
> same functionality. You can read about this in the official C# standard and
> other sources. Search for ISO/IEC 23270, "CLI, "CLR", "CLS", etc. For all
> intents and purposes however .NET is really the only game in town (on
> Windows anyway - you can read about the Mono project and others however). If
> an installation program isn't asking you to install it then it either
> assumes it's already installed (very good chance these days), will be
> installed (manually), or it's specifically checking that it's installed
> (note BTW that it's shipped with the latest MSFT OSs but may not be
> installed by default - it can be installed using the "control panel"
> however). In any case, you can't run your program without it, even if you
> find "tricks" that rely on it indirectly. You might find "ngen.exe"
> interesting for instance but all this does is JIT-compile your code up
> front.

Ok. Actually I just needed it so other people that use my program
won't have to install .NET (from what I saw, most people don't have
it)
Thanks,
Ofir.
Author
11 Jun 2009 3:07 PM
Mark Rae [MVP]
"ofiras" <ofi***@gmail.com> wrote in message
news:4feebf2a-32bf-41d5-a632-69ee8d66ec6e@h28g2000yqd.googlegroups.com...

> from what I saw, most people don't have it

That's completely incorrect.

The vast majority of Windows XP and Vista installations already include at
least one version of the .NET Framework...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Author
11 Jun 2009 4:23 PM
John
"Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message
news:OgIbKZq6JHA.1196@TK2MSFTNGP03.phx.gbl...
> "ofiras" <ofi***@gmail.com> wrote in message
> news:4feebf2a-32bf-41d5-a632-69ee8d66ec6e@h28g2000yqd.googlegroups.com...
>
>> from what I saw, most people don't have it
>
> That's completely incorrect.
>
> The vast majority of Windows XP and Vista installations already include at
> least one version of the .NET Framework...
>

To clarify:

Windows XP does *not* include the .NET Framework.  It is
true that a substantial number of XP installations have a version
of .NET installed for one reason or another.  I am not sure if
the total qualifies as vast majority or not.

It is a common myth that .NET is installed with one of the service
packs for XP (SP2, SP3)--it is not.

It is a common myth that .NET is installed automatically as part
of a Critical or High Priority Automatic Update to XP--it is not.

There may be some OEMs that include .NET as part of their
standard XP image, however, I am not able to verify that at the
moment.  It is logical since some third-party software that OEMs
load need .NET to run.

One interesting anecdote.  I recently purchased a Samsung
netbook with XP Home SP3 pre-installed.  No .NET.

If you have MSDN or similar you may want to download
one of the XP install images as an experiment.  Load it in
a VM, and notice that there is no .NET framework.

J
Author
11 Jun 2009 6:17 PM
Cor Ligthert[MVP]
Because of the same reason they never ask you to install a video driver.

Cor
Author
12 Jun 2009 11:35 AM
Jon
If you like the convenience and simplicity of coding in C# but don't want to use .NET, the way to go
might be to use something like Delphi.



"ofiras" <ofi***@gmail.com> wrote in message
news:163be675-17bd-4357-a440-25395e56a5d4@w40g2000yqd.googlegroups.com...
Hi,
I never understood how can it be that most programs don't ask me to
install .NET, although I know that many companies use C#. Is there any
way to make an exe of a C# program that doesn't need .NET to be
installed? If so, how can I do it?
Thanks,
Ofir.

Bookmark and Share