How To Ideas | How To Articles | How To Tutorials


5

How To Compile And Run C# Applications Using Command Prompt


Some people think that Visual Studio is necessary to Compile and Run .NET Applications, but it is not so. You only need to have .NET Framework installed on your Computer which is of very small size around 40mb and is available for free download on Microsoft’s website. Once you have .NET Framework installed on your Computer, then you can Compile and Run your Applications using Command Prompt only.  If you have Visual Studio installed, then you can also use Visual Studio Command Prompt tool to Compile and Run your Applications which is by default already Configured to run .NET syntax and commands. For that You can see my article on How To Compile C# Applications using Visual Studio Command Prompt. If you don’t have Visual Studio installed, then you can configure the Windows Command Prompt as well to run the .NET commands and then Compile and Run your Applications.

Instructions:

  1. Open Command Prompt by first clicking on Start button, then searching for CMD.
    Compile And Run .NET Application Using Command Prompt
  2. In Command Prompt, type the following command, which will configure the Command Prompt to Run .NET syntaxes.

    Set PATH=%PATH%;%Windir%\Microsoft.NET\Framework\v3.5

  3. If you have some another version of .NET installed, then you can replace v3.5 with that version as well. To see what .NET version you have, Go to C->Windows->Microsoft.NET->Framework. In that folder, you will find one different folder for every version of .NET framework you have in your Computer. So, you can use any folder’s name in upper command by replacing v3.5
  4. Now your Command Prompt in configured to Compile and Run .NET syntax. Type csc filename.cs to Compile your file, which will create executable file of that code in the same drive with same name, but with .exe extension. Now to Run the .exe file just type its name there and press Enter.
    Compile And Run .NET Application Using Command Prompt 

Incoming search terms:

  • compile c# di cmd (1)
  • how to invoke command prompt command into c# net (1)
  • how to set path to compile c# in xp (1)
  • how to set the path for net on xp to run c# (1)
  • run c# from command line (1)
Filed in: C#, Windows Tags: , , , , , , , , , , , , , , ,

5 Responses to "How To Compile And Run C# Applications Using Command Prompt"

  1. Peter Spowart says:

    Thanks mate, this works well.

  2. Shiba Ashley says:

    thank you so much.i was stuck when i was reading for exams cause i didn’t have visual studio but your tutorial help alot.keep up the good work.i appreciate.

  3. Shilpi Rao says:

    thank u it help me a lot….

  4. Philemon Molekana says:

    Thank you very much, I was able to schedule my application using batch script and windows schedular

  5. Joji Samuel says:

    Thanks Mate!! Worked Just Fine!!!

Leave a Reply

Submit Comment



© 7856 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.