Get started with Visual Studio 2017

Creating and running a program

When you start writing code in Visual Studio, you begin with a project. A project contains all of the information and files required to create and run a program.

Visual Studio organizes projects into solutions. A solution is a collection of projects that are associated with each other. If you’re just getting started, a solution will probably only contain one project.

Creating a new project

The easiest way to start coding in Visual Studio is by creating a new project from a template – we’ll cover working with existing code in just a moment. Visual Studio will generate a preconfigured project with recommended tools and settings. You can create a new project by going to File → New → Project.

Creating a project

Use the selectors on the left to choose different types of languages or platforms to work with. For example, to create a basic C# project, such as for a “Hello World” application, select the template Console App (.NET Core) under the Visual C# selector. Name your project and specify its location, then click OK to create your project.

Working with existing code

Besides creating a new project, you can also work with existing code in Visual Studio using one of the following options:

Opening from an existing source control repository

If you have a code repository using Git, you can use the Team Explorer tool window to clone your repository and begin working on it. Go to File → Open → Open from Source Control, and make sure you’re in the Manage Connections screen of the Team Explorer by clicking the green Manage Connections button at the top of the tool window. Click Clone under Local Git Repositories, then enter the URL of your git repo to clone your repository.

Opening an existing project

If you have an existing Visual Studio project, you can open it by going to File → Open → Project/Solution.

Creating a Visual Studio project from existing code

For simple C++, C#, or Visual Basic programs that don’t have Visual Studio project and solution files, you can automatically generate Visual Studio projects for your code by using the project creation wizard at File → Open → Project From Existing Code.

Opening a folder

If you just want to edit code for an existing project without using Visual Studio’s project and build systems, you can open a folder through File → Open → Folder. Though you won’t have the full support of Visual Studio’s project system, you’ll be able to use syntax highlighting, navigate through your code, and debug for C++, C#, Visual Basic, Node.js, and Python projects. You can learn more about opening a folder on the Visual Studio blog and how to use it for C++ on the Visual C++ blog.

Running your code

To run your code, click the green play button in the toolbar.

Running a project

This runs your code with the debugger attached – this lets you pause your code at breakpoints, emit debugging messages, and use additional tools in Visual Studio while you’re running your code.

I ran into an issue Next: Editing code