This is your brain. This is your brain on computers.

Learn Visual Studio 2019 With No Experience in 2022

Whether you’re a student about to graduate, a recent graduate with a STEM degree, someone wanting to switch careers to software development, or someone just interested in learning more about software development, chances are high that you’ll need to use Visual Studio 2019 (and future versions) to manage your code. As one of the most complete IDEs on the market (free versions too), you’ll find support for C#, VB, C++, Python, C, HTML, CSS, TypeScript, F#, and a few others. With extensions, you might find support for more. That said, the flexibility and volume of choices can be overwhelming to beginners who have no idea where to start. Lucky you. You’ve found the perfect place to learn Visual Studio 2019 with no prior experience.

Yes, Visual Studio is tied to Windows. Yes, it’s created by Microsoft. Both of those associations can discourage people tied to open source. But the reality of the situation is that Microsoft has been making big strides in open source by creating tools like Visual Studio Code, opening up the source for .NET Core, and integrating Linux with Windows. Say whatever you want about Microsoft’s motives, some of their ducks are certainly in a row.

Here’s a quick disclaimer. This guide isn’t intended to be the absolute end to all Visual Studio documentation. If you read this guide from beginning to end, you’ll be dangerous enough to create solutions and projects, manage your files, manage project dependencies, customize your workspace, edit code, compile projects, fix errors, use source control, and get set up with some application extensions. No section will be exhaustive in its focus but will guide you in a direction of where to go so that you can begin learning more through hands on experience and self-learning.

By the way! Visual Studio 2019 is just one of the many great tools we suggest installing into your toolbox. There are other IDEs, lightweight editors, and development applications that you should learn so that you’ll have flexible options when tackling complex problems.

Installation

First things first. You’ll need to download and install Visual Studio before you can begin using it obviously. Don’t confuse Visual Studio 2019 with Visual Studio Code. They’re different tools for different purposes. In this guide, we are exclusively focusing on Visual Studio 2019.

Download Visual Studio 2019 Community Edition (free). Read our pricing guide for more detailed comparisons between editions. We suggest the Community Edition because you won’t need any of the features offered by the pricier (and they can be pricey) tiers.

Browser window showing where to click to download Visual Studio 2019 community edition.

You’re not going to need the thousands of options that are available to you during the initial installation process. This guide only uses the “.NET Core cross-platform development” group and its required dependencies. Feel free to opt in to anything else you think looks interesting but be aware that you will have to download everything. Some of these options can increase the download size by 5+ GB. Don’t worry if you don’t select anything else right now. You can always open this installer later and incrementally install things that you want to learn.

Visual Studio installer UI showing to install only .NET Core tooling.

Let the installer do its thing. Sit back, relax, and wait for the magic. While it’s downloading, you can check out our article on 5 Essential Visual Studio Extensions. Used properly, extensions have the potential to boost your productivity and development efficiency.

Creating a Project

Once everything is installed, the first order of business is to create something and take a tour of the user interface. Go ahead and open Visual Studio. You’ll first see the splash screen with some options to open or create projects.

In Visual Studio, the core collection of files is considered a Project. For example, you could have a Console App Project, a Website Project, or a Database Project.

Here is a non-exhaustive list of some things a Project determines:

  • Which files belong together (code, plain text, JSON, dependencies, and more)
  • Dependencies of that project such as NuGet packages (more on these later), DLLs, Windows SDKs, or other Projects that you’ve created
  • Which frameworks are being targeted during the compile process (.NET Framework version, .NET Core version)
  • Output types of the compilation such as executable or library

Since you have nothing created yet, you’ll have to create a new project in the lower right.

Visual Studio comes packed with project templates based on the options you selected during installation. For example, if you chose .NET Core and Database Tools, you’ll see project templates for .NET Console Apps, Database Projects, and other projects in those categories.

In your case, if you followed this guide exactly, you should search for “console” in the search box at the top to find the “C# Console App (.NET Core)” template. The language is indicated by the little green “C#” icon next to the title of the project template. Select it and click Next.

Visual Studio UI showing where to create a new .NET Core console application.

Next, name your project and confirm that the location in which it will be created is accurate. The worst feeling is when you’ve just created something but have no idea where it went on your hard drive. Keep the Solution name the same as the Project name for now. We’ll explain more about this later.

Visual Studio will then bootstrap whatever template you chose and open everything in the main user interface window for you to begin creating code.

Getting Acquainted With the UI

If you’ve never used Visual Studio before (and we’re assuming you haven’t), then you might be overwhelmed by the sheer volume of choices presented to you after project creation. Don’t look at everything at once. Let’s break down the user interface into the main sections one by one so that you can begin to understand them in isolation. Then you’ll be able to piece them together to understand how they interact with each other.

Note that this section of the guide isn’t intended to explain everything there is to know about each user interface group. There are detailed sections later in this guide which do a better job at that. Instead, use this section to get an overall picture of the main user interface to understand what and where things are located.

Remember to refer back to this image for each of the subsections below as the numbers correlate to the headers.

(1) Toolbars

Starting from the top are the toolbars (of which there are many that you can customize). By default, you’ll see the menu bar and the standard bar. While you can add and remove toolbars and the items within them, don’t go overboard. You’ll probably end up confusing yourself with too many or not enough options. We find that sticking to the default covers most scenarios. Of course, you can ignore us entirely and make it work best for you!

  1. New, Open, Save: Icons to open the new project wizard, open an existing file, save the currently open file, and save all files simultaneously. We suggest memorizing the shortcuts for these.
  2. Build: Menu to build, clean, rebuild, and manage build configurations. See below section on compiling your project.
  3. Debug: Button to begin debugging your project. See below section on debugging your project.
  4. Search: Global search across literally everything in Visual Studio including menus, settings, your solution, your project, your files. This is a seriously cool feature that makes it easy to find whatever you’re looking for anywhere in the application.

(2) Login to Microsoft Account

Many of the built-in features to Visual Studio require you to login to your Microsoft account so that you can link the product to your account. This will make sure that you’re licensed to use the edition you downloaded (in this case Community is free). You can also synchronize your Visual Studio settings across devices using your Microsoft account. If you don’t have a Microsoft account, you can also use your GitHub account. If you don’t have a GitHub account, you really should get one ASAP!

(3) Solution Explorer

On the right is the Solution Explorer. This is where you manage projects, dependencies, files, and more. If you’re familiar with the Windows File Explorer, then you’ll see that it’s quite similar. See the section below regarding Managing Files in a Project for more details.

  1. Solution Name: Name of the solution that is currently open. Solutions are collections of Projects which make it easy to group together related Projects for an application. For example, a web application might have a Project for HTML and CSS, a Project for business logic, and another Project for database connections.
  2. Project Names: List of Projects that exist under the opened Solution. Here you can add, remove, rename, and modify specific Projects.
  3. Dependencies List in Project: Dependencies are libraries and Projects that are required to exist before your application will function.
  4. File List in Project: List of files that exist in the project such as configuration files, classes, and databases.

(4) Text Editor

This is what you’re here for, right? The majority of the user interface is consumed by the text editor and rightly so. It is, after all, the most used part of the tool.

  1. Opened Files Tab: Across the top of the editor is a collection of tabs for each opened file.
  2. File Context: Below that is a bar indicating the context of the open file in relation to the Solution and Project. From left to right you can see the Project in which the file belongs, the namespace of the active class, and the name of the active function.
  3. File Content Editor: The editor where you can obviously type your code!
  4. Error/Warning Indicator: A quick visual indicator if there are any problems, errors, or warnings with the current state of your Project.
  5. File Metadata: A quick indicator of which line and character the cursor is, if you have TABS or SPACES active, and which line ending character you have active (CR, LF, CRLF).

(5) Errors, Output, More…

Across the bottom is a customizable collection of supporting windows such as Error List, Output, and Package Manage Console. There are a lot of other windows that can be docked here (many of them come from extensions), but we won’t cover them all here. The most important one to get used to is the Errors List Window. It will be your best friend and your worst enemy.

  1. Filter Errors, Warnings, Info: The three buttons near the top allow you to show/hide errors, warnings, and info messages in case you want to drill down into specific bug finding modes.
  2. Errors, Warnings, Info List: Displays detailed error, warning, and info messages about the active Solution. For example, if files can’t be found, or your code contains syntax errors, you’ll see a breakdown with line numbers of where those errors are occurring.
  3. Output and Package Manager Console Windows: Tabs across the bottom to switch between supporting windows. The Output Window is a generic console output for build results. The Package Manager Console is a Powershell emulator used to manage optional NuGet packages in your Solution and Projects.

(6) Properties Window

In the bottom right is a window containing details about the actively selected object in the editor. Pictured here is what the window displays if you have the Program.cs file selected and opened. This allows you to see and modify properties about the file such as build tasks, file names, and file paths.

Note that this window can vary dramatically depending on each type of object selected, so it isn’t possible to show every type of variation in this guide. The important thing to know is that this window is where you go to see details about selected objects. This becomes most important when using user interface designers with tools like WPF and Windows Forms.

Managing Solutions, Projects, and Files

A large portion of time in any development effort is spent managing files. Whether you’re creating them, moving them around, renaming them because you hate your original idea, or deleting them out of frustration, you’re going to need to get used to the way in which you perform these operations in Visual Studio. Sure, you can use the command line, but why context switch away from a perfectly good user interface complete with shortcuts?

Solution Explorer

Mentioned briefly above in this article, the Solution Explorer is where you manage all files in your Solutions and Projects. In this Window, the most commonly used features are:

  • Rename Solution, Projects, and Files
  • Add Projects to the active Solution
  • Add Files to the Projects in the Solution
  • Remove Projects from the active Solution
  • Remove files from the Projects in the Solution
  • Cut, Copy, Move Files between Projects and Folders
  • Build Solution and Projects
  • Manage NuGet packages in Solution and Project
  • Add references and dependencies to a Project

There are many other options that are revealed when right clicking on a Solution, Project, or File, so take some time to look through those menus. Many extensions and updates will modify these context menus, so be aware that they may grow over time.

Solutions Versus Projects

As a reminder, there are differences between Solutions and Projects. Projects are collections of Files and Dependencies to build compiled for a specific purpose like a library or an executable. Solutions are collections of Projects which make it easy to group together related Projects for an application. For example, a web application might have a Project for HTML and CSS, a Project for business logic, and another Project for database connections.

Here is a non-exhaustive list of some things a Project determines:

  • Which files belong together (code, plain text, JSON, dependencies, and more)
  • Dependencies of that project such as NuGet packages (more on these later), DLLs, Windows SDKs, or other Projects that you’ve created
  • Which frameworks are being targeted during the compile process (.NET Framework version, .NET Core version)
  • Output types of the compilation such as executable or library

Here is a non-exhaustive list of somethings a Solution determines:

  • Which Projects belong together (UI/UX, business logic, database connections)
  • Active build configurations to determine if Projects should be build using flags like 32-bit or 64-bit (and many other options)
  • Which Project is the “Startup Project” to determine where the entry point of the application is during debugging sessions

You can only have one active Solution open at any given time. If you attempt to open another Solution, Visual Studio will warn you that it will close the existing Solution and open whichever one you’ve requested. Keep that in mind in case you have unsaved changes.

Dependencies

Every Project has dependencies. Even if you built nothing more than a Console App that outputs “Hello World,” your Project will still have a dependency on the .NET Framework to function correctly. Traditionally, managing dependencies has been described as “hell.” Fortunately, Visual Studio makes it easy to manage your dependencies to avoid getting in to things like circular dependency loops or versioning mismatches.

In the Solution Explorer, you’ll see a drop down of dependencies of things like COM libraries, Frameworks, NuGet Packages, and referenced Projects. This helps you understand what you need before your project will compile and provides you with a hierarchy of dependencies for dependencies. Yikes, that sounds ugly, but it’s not so bad when you drill in to see everything on which your application relies.

References and be added and removed by right clicking the dependencies drop down. In the case of adding dependencies, you will use the Reference Manager Window. In this window, you’ll have the ability to search for local Projects to reference, COM libraries installed on your machine, or browsing manually for DLLs on your machine. You might use the last option in case you downloaded a precompiled library online that you want to manually reference and use in your project.

Add a New Class to Project

Using the Project created at the beginning of this guide, let’s add a new class file to the Project.

  • Right click the Project
  • Click Add > New Item…
  • Select Class from the window
  • Name the Class “MyClass” at the bottom
  • Click Add

Notice that a new file was added in the tree of your Project in the Solution Explorer. Now you can open that file and begin editing it if Visual Studio hasn’t already opened it for you.

You can add files at any level of the file hierarchy including at the top level Solution, the inner Projects, or folders within either of those levels.

Modify Files via Text Editor

Clicking on a File in the Solution Explorer will open it in the Text Editor. This is the main way that you interact with and modify files.

We highly suggest you perform the following customization until you get to a point where you are comfortable with the look and feel of the editor. You are, after all, going to spend the vast majority of your time interacting with this section. If it doesn’t feel right, you’ll experience a huge motivation drain.

  • Zoom: In the lower left, you’ll see a zoom indicator. Move it up and down until you find a good size for you.
  • TABS or SPACES: In the lower right, you’ll see a “TABS” or “SPC” text which indicates if you’re using TABS or SPACES. Obviously this is hugely personal, so we won’t tell you which one to pick, but definitely pick one that makes you happy.
  • Syntax highlighting: We wrote about this one in another article because it’s super important. In our opinion, the default colors in Visual Studio aren’t the greatest (especially the light theme). Install the Color Themes and the Color Themes Editor extensions to play around with colors that make you feel the most productive. Or use a prebuilt theme like Dainty.

The rest of the text editor is self explanatory if you’ve ever used any other text editor. Type what you want into it to create your code and be on with your day.

Simple Code Navigation

In complex Solutions, you’ll have a variety of Projects filled with a variety of Files which are in turn filled with a variety of classes and functions. Memorizing where everything is simply isn’t possible. Consider a scenario wherein you’ve created a function that’s called from three different Projects. A few months will go by, and we guarantee you’ll forget from where that function is called. As you’re editing your function, you might want to know which consumers you’ll break by updating a function signature.

That’s where the following code navigation shortcuts come in handy. All the commands seen below are used in the context of a selected item in the text editor window. You may want to jump to a definition of an object, a function, or a class. Or maybe you want to traverse an inheritance tree to quickly find where a base function is implemented.

Note that the shortcuts below are the default choices. You can change them to whatever you want.

Peek Definition (ALT + F12). In the screenshot below, you can see that the ProcessCommandAsync function is being called and its definition is revealed through the Peek Definition command. Instead of navigating you away from your current editor, the definition of the function will be revealed in a small box below the calling site. This lets you quickly look at where and what the implementation for the function is. Note that if you are referencing a function on an interface, the definition will be the interface and not the implementation. See “Go To Implementation” below.

Go To Definition (F12). Similar to Peek Definition, Go To Definition will reveal where the function is defined but will open the file in which the function is defined and switch the current editor to that file. Note that if you are referencing a function on an interface, the definition will be the interface and not the implementation. See “Go To Implementation” below.

Go To Base (ALT + HOME). In the event that you are using a class that inherits from a base class, you can jump from that class directly to its base class through this option. This makes it easier to traverse up an inheritance hierarchy.

Go To Implementation (CTRL + F12). This is probably our most used shortcut aside from saving and building the Solution. While you can use Go To Definition to see where the function is defined, you won’t be able to see the implementation if the definition exists on an interface. This option will bypass the interface definition and take you directly to the definition of the function. Note that if there are multiple definitions (for example, your interface IRunnable is implemented by both Cat and Dog classes, you will need to tell the editor which of the definitions you want to see.

Find All References (SHIFT + F12). Remember we mentioned at the beginning of this section that you would probably forget from where your function is being called? This command is your best friend in those scenarios. You can easily find all places that an object, class, or function is being referenced in your Solution by selecting the object and using this command. You’ll be presented with a hierarchy of where the references are located in the References Window tab next to the Error List and Output Windows. Clicking on a reference in the window will navigate you to the file and line where the reference is found.