How to debug or execute C# program in Visual Studio?

Using Visual Studio 2005/2008/2012/2013 or any version

Visual Studio is easiest way to handle C# code. To execute the program on visual studio, go through the following steps:
Step 1: Launch Visual Studio and go to File > New Project

Step 2: Select Visual C# in left pane and then choose Console Application. Name your Project and select Location and ok


Step 3: Visual Studio will open a code editor window including some necessary code.

Step 5: Now write now Write in Main method the following line of code  code and press F5 to run C# code.
Console.WriteLine("Hello Welcome to ChashLearner");
Step 6: You will see the  output in Visual Studio Command Prompt.

How to debug or execute C# program in Notepad?


Objective
  1. How to compile and run c# code in notepad as well as visual studio?
  2. How to run C# code in notepad as well as visual studio?

It has been seemed with various beginners that they are able to understand C# concept but they got failed while implementing their logic into program. The best way to get rid of this types of problem is practice. So, just understand the program that is mentioned below and try to run C# code on your system.

Using Notepad

Step 1: Open Notepad and write the following c# code carefully


Step 2: Now save this program as firstprogram.cs in csharp Folder in D drive (Create csharp Folder in D Drive). You must choose All Files in save as type box.

















Step 3: Go to Start > All Programs > Microsoft Visual Studio 2005 or 2008 > Visual Studio Tools > Visual Studio 2005 or 2008 Command Prompt.


  • Type D: and hit Enter
  • Now type cd csharp and hit Enter
  • You are in Csharp Folder now

 
Step 5: Now compile your program by following command:











You will see some information like compiler version number and framework information. There is no error, so you won’t get any error.


Step 6: Now, it’s turn to C sharp program. Just write your file name without extension and hit enter.














Step 7: 
You will get the This is my First C# Program  as output.

Installing Microsoft Visual Studio


Visual Studio supports different programming languages and allows the code editor and debugger to support (to varying degrees) nearly any programming language, provided a language-specific service exists. Built-in languages include C, C++ and C++/CLI (via Visual C++), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio 2010). Support for other languages such as M, Python, and Ruby among others is available via language services installed separately. It also supports XML/XSLT, HTML/XHTML, JavaScript and CSS. Java (and J#) were supported in the past.

Part 1 of 3: Downloading Visual Studio

1 Download Visual Studio Express 2013. You can download the software from the Visual Studio website.



2 Sign in to your Hotmail / Live account. You will be required to sign in to your Hotmail or Live account, if you have one. If you don't have an account, you can create one.


 


3 Click on your download. The specific software version you have requested will be listed under "Your Selection". Click on it to begin the download.

Part 2 of 3: Installing Visual Studio

1 Click "Install". Be sure to read and agree to the License Terms and Privacy Policy.

 

2 Wait for the install to complete. Before installing, a System Restore Point will be automatically created.


3 Click Launch once the install has completed. Allow a few minutes for Visual Studio to finish configuring its first startup.