How To Ideas | How To Articles | How To Tutorials


5

How To Compile C# Console Application Using Visual Studio Command Prompt


If you want to know how this Visual Studio Command Prompt works or how can you compile your Applications using this tool, then here is a simple guide to you. In this article, I will tell you how can you Compile an Application using this Command Prompt. For example purpose, I will be Compiling the Application which I have made in this one of my other articles How To Create Hello World! Program In C# Using Notepad. Here is snapshot of the code of that Application.
Compile And Run Program Using Visual Studio Command Prompt

Instructions:

  1. Open Visual Studio Command Prompt tools by clicking Start button and then All Programs –> Microsoft Visual Studio 2010 –> Visual Studio Tools –> Visual Studio Command Prompt. If you have previous version of Visual Studio, then you can open this tool by replacing 2010 in above hierarchy with your edition of Visual Studio.
    Compile And Run Program Using Visual Studio Command Prompt
  2. It will open a Command Prompt which will work like a Compiler for us.
    Compile And Run Program Using Visual Studio Command Prompt
  3. Now move to the directory where your .cs file is located which you want to Compile nowCompile And Run Program Using Visual Studio Command Prompt
  4. Type csc followed by a space then your file name which in my case is HowToIdeas.cs and hit Enter. You will get similar kind of output in Console as I have in following Image and it will take some time to Compile the program. Once it is Compiled it will show you the Path where you were i.e D:\ drive in my case.
    Compile And Run Program Using Visual Studio Command Prompt
  5. If you don’t get any error, then your Program is successfully Compiled and an .exe file with the same name as your .cs file name will got created in the same directory. So you can now run your Program by just typing the name of .exe file and it will show you the output of our Program in Console.
    Compile And Run Program Using Visual Studio Command Prompt

Incoming search terms:

  • How to run codes from notepad in visual studio Net (1)
Filed in: C#, Visual Studio Tags: , , , , , , , , , , , , , , ,

5 Responses to "How To Compile C# Console Application Using Visual Studio Command Prompt"

  1. Baljeet Singh Rangra says:

    Thanks for the guidance.

    Keep it up

  2. Sachin says:

    Thanks alot for this info.

  3. Priya says:

    Thanks a lot. this was so simple to understand. Very useful thanx for posting.

  4. aadi says:

    thank you so much…..now is properly know .thank you.

  5. Zuberi Mohammed Lusweka says:

    Thanks alot am very happy for your simple instruction it enable me to write my first C# program

    Regards
    From Nairobi.Kenya.

Leave a Reply

Submit Comment



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