C# Command Line Compiler (CSC.EXE)
What is CSC.EXE ?
Command line compiler takes C# code as input and transforms code to MSIL/CIL (Microsoft intermediate language/Common intermediate language).CSC.exe produces .dll (dynamic link library) and .exe (executable) files.
CSC.exe comes with .net framework.you can install it standalone too.which is in :
How to Compile C# programs using CSC.exe (Without using Visual Studio) ?
Step 1:
Create a program first -> myprogram.cs (name is upto you :P) , so we can compile that using CSC.EXE .
I have created a program containing simple code :
Step 2:
Step 3:
Like indian movies there is happy ending .. A myprogram.exe is generated on my desktop :) .Execute that exe using CMD to see the desired result :
YAY WE WON :P :) .Thats all what CSC.exe do for us .When we compile using visual studio its just use the same process we have done, behind the scene .
Command line compiler takes C# code as input and transforms code to MSIL/CIL (Microsoft intermediate language/Common intermediate language).CSC.exe produces .dll (dynamic link library) and .exe (executable) files.
CSC.exe comes with .net framework.you can install it standalone too.which is in :
c:\Windows\Microsoft.Net\Framework\v4.0.30319{version installed on your computer}\csc.exe
How to Compile C# programs using CSC.exe (Without using Visual Studio) ?
Step 1:
Create a program first -> myprogram.cs (name is upto you :P) , so we can compile that using CSC.EXE .
I have created a program containing simple code :
using System; public class myprogram { static void Main() { Console.WriteLine("I hate hello world"); } }
Step 2:
- Open the command prompt
- Reach at the palace where is your program file exists
- Locate the CSC (C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe )
- Give input to CSC (C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe myprogram.cs)
- .exe will be generated ;) :)
Step 3:
Like indian movies there is happy ending .. A myprogram.exe is generated on my desktop :) .Execute that exe using CMD to see the desired result :
YAY WE WON :P :) .Thats all what CSC.exe do for us .When we compile using visual studio its just use the same process we have done, behind the scene .
get video tutorial on how to compile C# program using command prompt
ReplyDeletehttp://easycodedotnet.blogspot.in/2015/07/c-sample-program.html
Great Article
ReplyDeleteFinal Year Projects for CSE in Dot Net
FInal Year Project Centers in Chennai
JavaScript Training in Chennai
Dot Net Training in Chennai