How to Download and Installing Visual Studio

How to download, install and configure Visual Studio and take a look at some of the features of the development environment.

By Tim Trott | C# ASP.Net MVC | October 10, 2008
1,748 words, estimated reading time 6 minutes.

Installing Visual Studio

Visual Studio 2022 is one of the easiest releases to install. Simply download the bootstrapper, run and select the components you wish to use. We'll guide you through this process.

First, we need to check the system requirements. Visual Studio doesn't require a powerful machine, but it does require a significant amount of storage. You will need to be running Windows 7 or above.

You should have a 1.8 GHz or faster processor. Dual-core or better is recommended. 2 GB of RAM is the minimum, however, 4 GB of RAM is recommended for optimum performance. Hard disk space. This is a large application with all its supporting development frameworks, libraries and tools. You will need up to 130 GB of available space, depending on features installed; with typical installations requiring 20-50 GB once installed. To improve performance, install Windows and Visual Studio on a solid-state drive (SSD). Finally, you will need a video card that supports a minimum display resolution of 720p (1280 by 720); Visual Studio will work best at a resolution of WXGA (1366 by 768) or higher. You will also require Administrator rights to install Visual Studio.

If your system meets all these requirements we can go to the Microsoft website and download the installer.

Download Visual Studio 

When the file has finished downloading, run the bootstrapper file to install the Visual Studio Installer. This new lightweight installer includes everything you need to both install and customize Visual Studio 2017. If you receive a User Account Control notice, click Yes.

Proceed to acknowledge the Microsoft License Terms and the Microsoft Privacy Statement and click Continue.

After the installer is installed, you can use it to customize your installation by selecting the feature sets that you want.

After you select the workload(s) you want, click Install.

Next, status screens appear that show the progress of your Visual Studio installation.

After the new workloads and components are installed, click Launch.

At any time after installation, you can install workloads or components that you didn't install initially. If you have Visual Studio open, go to Tools > Get Tools and Features... which opens the Visual Studio Installer. Or, open Visual Studio Installer from the Start menu. From there, you can select the workloads or components that you wish to install, then click Modify.

Using the Visual Studio IDE

In this tutorial, we will look at the Visual Studio Integrated Development Interface (IDE) and see how it makes our software development much easier. We will look at syntax highlighting, Intellisense and the toolbars. We will also look at different methods of running an application.

Syntax Highlighting

You have probably noticed that as you type the code in, Visual Studio will change the colour of the words. This is Syntax Highlighting and it the there purely to aid readability.

In general:

  • Keywords are blue
  • Comments are green
  • Strings are red/brown
  • Classes are gray

You can change these colours from within the program settings dialogue box if you would prefer different colours.

IntelliSense

Using our hello world application from the last tutorial, we are going to invoke IntelliSense and let it write code for us. If you types in the code in the last tutorial you will have seen IntelliSense, however, if you used copy and paste to insert the code, then now you will see IntelliSense.

Start off my deleting the Console.WriteLine line, then just type 'C'. Notice a pop-up window with a list of items beginning with 'C', also note that Console is the highlighted item. This is the item that Visual Studio thinks you are most likely to use in the current context. We can now press Enter, or just '.' and IntelliSense will type the rest of the word for you, and bring up another selection box, this time with WriteLine selected.

IntelliSense demonstration
IntelliSense demonstration

You can use the arrow keys to select different items on the list. Scroll up to C and notice that Console is not on the list anymore. This is because IntelliSense will only offer suggestions based on the current context. This little example will show all the methods and properties of the Console.

As we are looking at 'C' on the list, type in 'W' and the IntelliSense will jump back down to WriteLine. We can see by the icon (see below for examples) that WriteLine is a method we can call, so type in an open parenthesis and IntelliSense will now give you the method name, a description of what it does and the parameters that it takes. Notice in the top left it says "1 of 19", this function has been overloaded and can take many different types of parameters. Don't worry about this just yet though, but you can use the up and down keys to look through them if you wish.

If for some reason IntelliSense does not automatically pop up, you can use (Ctrl+Space) to have it pop up at the cursor.

IntelliSense Icons

Here are a few of the common icons used in IntelliSense and what they mean. Don't worry if you don't understand the terms, they are all explained in later tutorials.

  • Classes
  • Methods
  • Properties
  • Namespace

Regions and Blocks

Visual Studio and Visual C# allow sections of code to be hidden away or collapsed. A section of code between two braces is called a region and can be collapsed or expanded by using the plus or minus icon near the gutter. The gutter is the grey column down the left-hand side of the code window. We will see what the gutter is used for when we look at Debugging.

You can collapse block-level code that is nested within your methods, you can collapse the namespace, or you can collapse any block of code between the two.

The code does not get deleted, just hidden from view. This is very useful because it can hide away code that you may not be interested in and de-clutter the code window, so all your attention is on the code you are writing.

You can also define your collapsible blocks of code by using the region and endregion keywords. To start a region, type #region , and at the end of the block of code type #endregion. The editor will now allow you to collapse this code.

C#
#region myRegion
  Console.WriteLine("Please Enter Your Age:");  
  string myName = Console.ReadLine();
  Console.WriteLine("You Entered: " + myName);
#endregion

Visual Studio Task List

Visual Studio contains a nice feature which is a Task List. This view is similar to the Output view but shows all the tasks associated with the project or solution.

To view the task list select View menu then Task list (Ctrl+W, T). Tasks can be added with the "Create User Task" button and checked off when done.

Visual Studio Task List
Visual Studio Task List

The best feature for me, however, is its ability to automatically add and track TODO comments in your source code. When coding I often add a comment for things that need fixing or implementing in the future, the task list will pick up on these items so you can view them all and go directly to them.

C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      myArrayList myList = new myArrayList();
      / TODO: Genereate these dynamically
      myList.Add("iulwrg");
      myList.Add("3847987");

      Console.WriteLine(myList.ToString());
    }
  }

  class myArrayList : System.Collections.ArrayList
  {
    public override string ToString()
    {
      /HACK: This is a messy way, but works for now. Make it better.
      string result = "";

      /UNDONE: Removed for testing
      /string[] theItems = (string[])base.ToArray(typeof(string));

      foreach (string item in theItems)
      {
        result += " " + item;
      }
      return result;
    }
  }
}

This code will be scanned by the task list view and will pick up on the comment tags TODO, HACK and UNDONE.

You can define your tags from the options screen (Tools » Options » Environment » Task List »Task List Options and add a comment token with the appropriate priority). FIXME is my personal favourite.

Visual Studio Task List - Comment Tags
Visual Studio Task List - Comment Tags

XML Documentation in Visual Studio

Visual Studio provides the ability to generate project documentation using comments in the code with embedded XML tags. These can be easily converted to printable or human-readable documents using style sheets.

The code editor will automatically provide the XML tags, all you need to do is to fill in the text as you code. XML documentation is slightly different from normal code comments in that it uses three forward slashes (//) instead of two. The editor will provide a list of tags that you can use, including a title and description for methods.

By typing // in front of a method, the editor will auto-complete a basic documentation layout for that method.

C#
// <summary>
//
// </summary>
// <param name="args"></param>
static void Main(string[] args)
{
}

All you need to do is fill in a summary of the method (what it does, called by, any data it returns etc...) and a description of the parameters it takes.

Using IntelliSense (Ctrl+Space) you can bring up a list of tags that can be used, including examples, see also and permissions.

It is good practice to comment on your code as you progress.

A well-commented application permits a developer to fully understand the structure of the application and how the various aspects interact with each other. It also allows other developers to understand the project much quicker as they spend less time trying to work out what everything does.

When your code is complete and commented you can generate documentation by configuring the project properties.

Either right-click the project in the Solution Explorer or select Properties from within the Project menu. At the bottom of the build tab, there is an option to generate XML Documentation. Just enter a path for the documentation to be stored within. It will default to your project directory + "bin/debug/.xml".

You can also use the command line tool, csc.exe, to generate a documentation file:

csc program.cs /doc:my-xml-documentation.xml

Additionally, the text within the

tags is used by IntelliSense as the method description when prompting for info in the code designer. If you are developing code that will be reused by different people it is highly recommended that each method has at a minimum a summary section.

IntelliSense demonstration
IntelliSense demonstration

The resulting XML from the documentation isn't very readable to humans, but we can use an XML transformation to generate an HTML version. There is a good example style sheet on codeproject.com  to download and use.

Was this article helpful to you?
 

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

There are no comments yet. Why not get the discussion started?

We respect your privacy, and will not make your email public. Learn how your comment data is processed.