top

Search

C# Tutorial

In this tutorial, we will be learning how to run C# programs on Windows. C# programs are generally run on Windows Operating System since it was developed by Microsoft.Nowadays, Microsoft and other IDEs are coming up with support of C# on Linux and Mac. Still, the most preferred way of running C# programs is by using Microsoft Visual Studio.To setup environment for running C# programs on Windows, you need to use Visual Studio IDE.Let us first see what it is.What is Visual Studio 2017 IDE?Visual Studio is an Integrated Development Environment (IDE) from Microsoft. It is used to develop websites, computer programs, web apps, web services etc. The current version is Visual Studio 2017. It released on 7 March 2017 and has many new features such as support for EditorConfig, NGen Support, .NET Core as well as preview for Docker toolset and Xamarin 4.3.FeaturesThe different features in Visual Studio 2017 IDE are:1. Write code effectivelyCode can be written accurately and effectively using Visual Studio without losing the current file context. Various parts of the program such as call structure, related functions, check-ins, test status etc. can be seen in detail.2. DebugBugs can be quickly and easily found and fixed using the Visual Studio debugger. This can be done across languages and locally as well as remotely.3. TestVisual Studio test tools provide various features such as quality metrics, indicators, test status reporting etc. These can be used to plan and execute the testing effort.4. CollaborateThe source code can be managed in Git repos hosted by any provider. Azure DevOps can also be used to manage code for the project.5. ExtendThe Visual Studio functionality can be extended by using various tools, controls and templates available in Microsoft.There are three editions of Visual Studio 2017 IDE available. These are:1. Visual Studio Community 2017This is a free IDE for students, individual developers and open source projects.2. Visual Studio Professional 2017This is for professional developers and contains tools, services and subscription benefits for small teams.3. Visual Studio Enterprise 2017This provides solutions to meet quality and scale needs of teams of all sizes.We will use the Microsoft Visual Studio Community 2017.Install Microsoft Visual Studio Community 2017Now, let us see how to download and install Visual Studio 2017:To download Visual Studio, you need to go to Microsoft Visual Studio official website.Now, as shown below, download the Community edition, by clicking “Free download”. An exe file will start downloading:Figure 2: Download the installer file for Visual Studio Community EditionAfter downloading the exe file, you need to run it.On running, the following dialog box is visible, that begins the installation.Click “Continue” to proceed further:Figure 3: Visual Studio Installer On  clicking ”Continue” above, the packages and libraries for Visual Studio begin downloading and installing as shown below:Figure 4: Downloading Visual StudioNow, select the environment. We want to run program on C# Console Application, therefore select “.NET Desktop Development”:Figure 5: Select the desktop environment for C# Console applicationAfter selecting, on the right you can see the details of the tools and packages that will get installed appears for “.NET desktop development”. We want it for basic setting, so we will keep it default.However, the optional section shows the installation of the following tools, packages and debugger:.NET Framework 4-4.6 development toolsBlend for Visual StudioEntity Framework 6 tools.NET profiling toolsThe screenshot shows the same:Figure 7: Downloading and Installing packages and tools for Visual Studio Community 2017After the installation finishes, you will get a message to reboot the system. Rebooting will complete the installation process for Visual Studio Community 2017:The following shows the same message: Figure 8: Visual Studio Community 2017 installation finishesAfter rebooting the system, now let us learn how to start “Visual Studio Community 2017”.Go to “Start” and type “Visual Studio” as shown below. Figure 9: Start with Visual Studio 2017“Visual Studio 2017” appears, click on it as shown below:Figure 10: Click and begin Visual Studio 2017After clicking above, the “Visual Studio” dialog box appears. Now signup and create a new account to get Azure credits, else leave it and click “Not now, Maybe later”:Figure 11: Visual Studio first dialog box Now, a new dialog box appears for “Development Settings” and “Theme”. The “Development Settings” give you an option to set a development environment. Keep it:“General” for default, “C#” for only C# development environment, “F#” for F# Development Environment, etc.We want to run programs in C#, therefore, we can select “General” or “C#. Set theme according to your requirement of color combinations and click “Start Visual Studio” as shown below: Figure 12: Set Development Environment and theme color After clicking “Start Visual Studio”, the IDE starts loading and appearing:Figure 13:  Visual Studio getting started Now, Visual Studio IDE appears as shown below.The start page is visible now:Figure 14: Visual Studio Start Page Now, in the next lesson, let us see how to create a new project and run our first program in C# using Visual Studio IDE.
logo

C# Tutorial

Set Environment

In this tutorial, we will be learning how to run C# programs on Windows. C# programs are generally run on Windows Operating System since it was developed by Microsoft.

Nowadays, Microsoft and other IDEs are coming up with support of C# on Linux and Mac. Still, the most preferred way of running C# programs is by using Microsoft Visual Studio.

To setup environment for running C# programs on Windows, you need to use Visual Studio IDE.

Let us first see what it is.

What is Visual Studio 2017 IDE?

Visual Studio is an Integrated Development Environment (IDE) from Microsoft. It is used to develop websites, computer programs, web apps, web services etc. The current version is Visual Studio 2017. It released on 7 March 2017 and has many new features such as support for EditorConfig, NGen Support, .NET Core as well as preview for Docker toolset and Xamarin 4.3.

Features

The different features in Visual Studio 2017 IDE are:

1. Write code effectively

Code can be written accurately and effectively using Visual Studio without losing the current file context. Various parts of the program such as call structure, related functions, check-ins, test status etc. can be seen in detail.

2. Debug

Bugs can be quickly and easily found and fixed using the Visual Studio debugger. This can be done across languages and locally as well as remotely.

3. Test

Visual Studio test tools provide various features such as quality metrics, indicators, test status reporting etc. These can be used to plan and execute the testing effort.

4. Collaborate

The source code can be managed in Git repos hosted by any provider. Azure DevOps can also be used to manage code for the project.

5. Extend

The Visual Studio functionality can be extended by using various tools, controls and templates available in Microsoft.

There are three editions of Visual Studio 2017 IDE available. These are:

1. Visual Studio Community 2017

This is a free IDE for students, individual developers and open source projects.

2. Visual Studio Professional 2017

This is for professional developers and contains tools, services and subscription benefits for small teams.

3. Visual Studio Enterprise 2017

This provides solutions to meet quality and scale needs of teams of all sizes.

We will use the Microsoft Visual Studio Community 2017.

Install Microsoft Visual Studio Community 2017

Now, let us see how to download and install Visual Studio 2017:

To download Visual Studio, you need to go to Microsoft Visual Studio official website.

Now, as shown below, download the Community edition, by clicking “Free download”. An exe file will start downloading:

Download the installer file for Visual Studio Community Edition

Figure 2: Download the installer file for Visual Studio Community Edition

After downloading the exe file, you need to run it.

On running, the following dialog box is visible, that begins the installation.
Click “Continue” to proceed further:

Visual Studio Installer

Figure 3: Visual Studio Installer 

On  clicking ”Continue” above, the packages and libraries for Visual Studio begin downloading and installing as shown below:

Downloading Visual Studio

Figure 4: Downloading Visual Studio

Now, select the environment. We want to run program on C# Console Application, therefore select “.NET Desktop Development”:

Select the desktop environment for C# Console application

Figure 5: Select the desktop environment for C# Console application


After selecting, on the right you can see the details of the tools and packages that will get installed appears for “.NET desktop development”. We want it for basic setting, so we will keep it default.

However, the optional section shows the installation of the following tools, packages and debugger:

  • .NET Framework 4-4.6 development tools
  • Blend for Visual Studio
  • Entity Framework 6 tools
  • .NET profiling tools

The screenshot shows the same:

Downloading and Installing packages and tools for Visual Studio Community 2017

Figure 7: Downloading and Installing packages and tools for Visual Studio Community 2017

After the installation finishes, you will get a message to reboot the system. Rebooting will complete the installation process for Visual Studio Community 2017:

The following shows the same message:

Visual Studio Community 2017 installation finishes

 

Figure 8: Visual Studio Community 2017 installation finishes

After rebooting the system, now let us learn how to start “Visual Studio Community 2017”.

Go to “Start” and type “Visual Studio” as shown below.

 Start with Visual Studio 2017

 Figure 9: Start with Visual Studio 2017

“Visual Studio 2017” appears, click on it as shown below:

Click and begin Visual Studio 2017

Figure 10: Click and begin Visual Studio 2017

After clicking above, the “Visual Studio” dialog box appears. Now signup and create a new account to get Azure credits, else leave it and click “Not now, Maybe later”:

Visual Studio first dialog box

Figure 11: Visual Studio first dialog box

 Now, a new dialog box appears for “Development Settings” and “Theme”. The “Development Settings” give you an option to set a development environment. Keep it:

  • General” for default, 
  • C#” for only C# development environment, 
  • F#” for F# Development Environment, etc.

We want to run programs in C#, therefore, we can select “General” or “C#. Set theme according to your requirement of color combinations and click “Start Visual Studio” as shown below:

Set Development Environment and theme color

 Figure 12: Set Development Environment and theme color

 After clicking “Start Visual Studio”, the IDE starts loading and appearing:

Visual Studio getting started

Figure 13:  Visual Studio getting started

 Now, Visual Studio IDE appears as shown below.

The start page is visible now:

Visual Studio Start Page

Figure 14: Visual Studio Start Page

 Now, in the next lesson, let us see how to create a new project and run our first program in C# using Visual Studio IDE.

Leave a Reply

Your email address will not be published. Required fields are marked *

Suggested Tutorials

Swift Tutorial

Introduction to Swift Tutorial
Swift Tutorial

Introduction to Swift Tutorial

Read More

R Programming Tutorial

R Programming

Python Tutorial

Python Tutorial