C Board  

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

Reply
 
LinkBack Thread Tools Display Modes
Old 11-12-2008, 09:38 AM   #1
Registered User
 
Join Date: Aug 2005
Posts: 180
Does C# compile to an exe?

I'm a noob to C#. Does C# compile to an executable .exe file the way that C++ does? I understand that it compiles to byte code like Java, but I wasn't sure if I had to type something like "ms-csharp my_prog.class" in order to run it.

Also, is it possible to compile C# to a .DLL file in a way similar to C++?

Last edited by thetinman; 11-12-2008 at 09:39 AM. Reason: added dll Q
thetinman is offline   Reply With Quote
Old 11-12-2008, 10:15 AM   #2
Registered User
 
valaris's Avatar
 
Join Date: Jun 2008
Location: RING 0
Posts: 462
Not like C++ does, but to an executable that the CLR can understand. MIL, microsoft intermediate language. Each method call is Jittered (JIT) or just in time compiled before it executes. So in order for a computer to run this it will need the .Net framework installed on the machine, luckily this is most modern microsoft machines. This is similar to the java runtime in a sense.

To a user though, as long as they have the framework installed, the executable is transparent to what language it was written in and behaves like a normal program.
valaris is offline   Reply With Quote
Old 11-12-2008, 03:08 PM   #3
Registered User
 
Join Date: Aug 2005
Posts: 180
Is the code compiled into an executable that I can click on to run?
thetinman is offline   Reply With Quote
Old 11-12-2008, 03:40 PM   #4
Ex scientia vera
 
Join Date: Sep 2007
Posts: 426
Yes. But the executable code contained in it does not contain the instructions that do what the C# code does, not in the format the specified cpu architecture can understand at least. The code stored in the executable is run by the CLR, but yes, it does compile to an executable.
__________________
"What's up, Doc?"
"'Up' is a relative concept. It has no intrinsic value."
IceDane is offline   Reply With Quote
Old 11-17-2008, 07:41 AM   #5
chococoder
 
Join Date: Nov 2004
Posts: 443
C# code compiles to a .NET assembly.
This can be an executable for use within the .NET CLR, a dll for use with the CLR, or a type library for inclusion in other .NET assemblies.

If an executable, it will have a .exe extension as standard.
jwenting is offline   Reply With Quote
Old 11-20-2008, 08:18 PM   #6
/*enjoy*/
 
Join Date: Apr 2004
Posts: 159
Cool

Quote:
Originally Posted by jwenting View Post
C# code compiles to a .NET assembly.
This can be an executable for use within the .NET CLR, a dll for use with the CLR, or a type library for inclusion in other .NET assemblies.

If an executable, it will have a .exe extension as standard.
just a question

it's possible to compile anexe with c# so excute within framework installed ?

somewone have an explication please
enjoy is offline   Reply With Quote
Old 11-21-2008, 06:12 AM   #7
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 2,927
No, it is not possible to compile C# so that it can run without the framework installed. C# only half compiles, the final compilation is done by the framework at runtime. This is both a good feature and a security risk. It is good because in theory as new processor technologies become available and the framework is updated, your existing applications will take advantage of these if possible. It is a security risk because anyone that makes half an effort can extract your source code from the executable.
__________________
He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet
abachler is offline   Reply With Quote
Old 11-21-2008, 11:17 AM   #8
Registered User
 
Join Date: Aug 2008
Posts: 188
Quote:
Originally Posted by abachler View Post
No, it is not possible to compile C# so that it can run without the framework installed. C# only half compiles, the final compilation is done by the framework at runtime. This is both a good feature and a security risk. It is good because in theory as new processor technologies become available and the framework is updated, your existing applications will take advantage of these if possible. It is a security risk because anyone that makes half an effort can extract your source code from the executable.
both of which can be resolved with 3rd party tools.
bling is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile crashes certain windows Loduwijk C++ Programming 5 03-26-2006 09:05 PM
No compile time errors, exe crashes. RealityFusion C++ Programming 13 09-06-2005 12:34 PM
open scene graph compile issues ichijoji Game Programming 1 08-04-2005 12:31 PM
compile program? Goosie C++ Programming 9 06-22-2005 02:26 PM
dvv-cpp not able to compile? Rune Hunter C++ Programming 12 10-23-2004 06:36 PM


All times are GMT -6. The time now is 05:57 AM.


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