All Type Coding

Search Here

How to use command line tools in c#

The command line compiler is a very powerful tool. You can build large complex Solutions from the command line just as easily as you can build a small “My First Program”CSC is the command for compiling the CSharp source code on Command Line . When you run the CSC Command on Command line the program generate a .EXE file. Create new Text document and copy and paste below code like below















Now Save this file like below


Select the location where you want to save this file like below. Here I select the desktop location and give the name of file with .cs 
For Example. SimpleProgram.cs

After saving the file you will see one file created  on that selected location like below

Now go to start menu click on microsoft visual studio 2010 or 2012 whatever version  is there and click visual studio tool and select  Developer Command Prompt like below ...

Now first of all set the directory like below I set that directory where is your source file Here I set my directory desktop like below.

When you run the CSC Command on Command line the program generate a .EXE file. on same location where is that your source file like below Here left file is .EXE file and right side is the source file. We execute or call this file like above
for example.
csc SimpleProgram.cs
after executing we call .EXE file 
For Example:
SimpleProgram.exe
after executing the above line its show output like above screen "My First Program"



No comments :

Post a Comment