C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-30-2009, 03:34 AM   #1
Registered User
 
RocketMan's Avatar
 
Join Date: Dec 2007
Posts: 26
C# Compiling to standalone exe

Hi All,

Im just after some general imformation and tips about c#.

Im just about to write a simple windows app, but want it versitile so it can run on windows 2000, xp, vista and the latest windows just comming out. So my very technical question is, can i write a c# app and generate an exe that can work on all of these platforms, and easy for the customer to deploy without downloading patches from the microsoft site? I seem to remember people saying its hard to create a true exe in c#?

Would i be better creating it in borland c++ or something. What do you recommend?

Regards,

Rocketman.
RocketMan is offline   Reply With Quote
Old 09-30-2009, 05:40 AM   #2
Registered User
 
C_ntua's Avatar
 
Join Date: Jun 2008
Posts: 1,135
I believe it could. C# is usually (always?) translated in CIL which is independent from CPU or platform. So yeah, you would be able.
The downside is that the computer would have to have the .NET framework installed

You could turn a C# in machine code directly as C/C++ compilers do. But the recommended, default, fun, happy, we-all-do-it option is to go with the above
C_ntua is offline   Reply With Quote
Old 09-30-2009, 11:03 AM   #3
Registered User
 
valaris's Avatar
 
Join Date: Jun 2008
Location: RING 0
Posts: 462
Assuming the users of your application have the appropriate framework installed that your application was targeted to, it will run fine. This is a major design goal of .NET. Also newer frameworks that come out also support the older framework, that being said when windows 7 is released, your .NET 2.0 applications should still run as expected.
valaris is offline   Reply With Quote
Old 10-01-2009, 11:31 AM   #4
Registered User
 
RocketMan's Avatar
 
Join Date: Dec 2007
Posts: 26
Hi,

Thanks for your replies.

The only reason I ask is because one of my friends said its best to write in C++ MFC because this enviroment is able to create a standalone exe. However I have heard writting MFC from the word go can be very hard to learn? So your advice would be to go with C#?

Cheers.

Rocketman.
RocketMan is offline   Reply With Quote
Old 10-03-2009, 09:14 AM   #5
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,472
You can create a true EXE in C# but you lose all the benefits of .NET and assemblies and the EXEs are far bigger than the assemblies.

When you compile C# to an executable it will bring in all of the .NET framework that is being used. Since most C# programs use only a portion of the framework this really bloats the code. Even though you may only be using 5 to 10 percent of one portion of .NET it will bring in 100% of it. It may also run slower or faster depending on how the compiler treats the MSIL and brings it down to native code. One thing is for sure though you can kiss your 250kb apps goodbye b/c compiling to a native EXE can bloat the code by a factor of 10 or more.
__________________
If you aim at everything you will hit something but you won't know what it is.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screwy Linker Error - VC2005 Tonto C++ Programming 5 06-19-2007 02:39 PM
how to run an exe command in c++ and get back the results? mitilkhatoon C++ Programming 5 09-21-2006 06:00 PM
Close another exe from another exe?? Tony Windows Programming 1 06-12-2002 07:19 AM
insert another exe into exe lliero C Programming 8 04-12-2002 12:22 PM
adding bytes to EXE to call another EXE lliero C Programming 2 03-30-2002 07:23 AM


All times are GMT -6. The time now is 01:56 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22