Skip to content

Commit 68f5bde

Browse files
author
Colin Robertson
committed
Fix 1794 project solution confusion
1 parent 091f5f2 commit 68f5bde

2 files changed

Lines changed: 48 additions & 32 deletions

File tree

docs/build/vscpp-step-1-create.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Create a C++ console app project
33
description: "Create a Hello World console app in Visual C++"
44
ms.custom: "mvc"
5-
ms.date: 04/02/2019
5+
ms.date: 04/20/2020
66
ms.topic: "tutorial"
77
ms.devlang: "cpp"
88
ms.assetid: 45138d70-719d-42dc-90d7-1d0ca31a2f54
@@ -17,24 +17,26 @@ The usual starting point for a C++ programmer is a "Hello, world!" application t
1717

1818
## Create your app project
1919

20-
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize your projects. A project contains all the options, configurations, and rules used to build your apps, and manages the relationship between all the project's files and any external files. To create your app, first, you'll create a new project and solution.
20+
Visual Studio uses *projects* to organize the code for an app, and *solutions* to organize your projects. A project contains all the options, configurations, and rules used to build your apps. It manages the relationship between all the project's files and any external files. To create your app, first, you'll create a new project and solution.
2121

2222
::: moniker range=">=vs-2019"
2323

24-
1. In Visual Studio, open the **File** menu and choose **New** > **Project** to open the **Create a new Project** dialog. Select the **Console App** template, and then choose **Next**.
24+
1. In Visual Studio, open the **File** menu and choose **New > Project** to open the **Create a new Project** dialog. Select the **Console App** template that has **C++**, **Windows**, and **Console** tags, and then choose **Next**.
2525

2626
![Create a new project](media/vs2019-choose-console-app.png "Open the Create a new project dialog")
2727

2828
1. In the **Configure your new project** dialog, enter *HelloWorld* in the **Project name** edit box. Choose **Create** to create the project.
2929

3030
![Name and create the new project](media/vs2019-configure-new-project-hello-world.png "Name and create the new project")
3131

32-
Visual Studio creates a new project, ready for you to add and edit your source code. By default, the Console App template fills in your source code with a "Hello World" app:
32+
Visual Studio creates a new project. It's ready for you to add and edit your source code. By default, the Console App template fills in your source code with a "Hello World" app:
3333

3434
![Hello World project in the IDE](media/vs2019-hello-world-code.png "Hello World project in the IDE")
3535

3636
When the code looks like this in the editor, you're ready to go on to the next step and build your app.
3737

38+
[I ran into a problem.](#create-your-app-project-issues)
39+
3840
::: moniker-end
3941

4042
::: moniker range="<=vs-2017"
@@ -43,21 +45,21 @@ Visual Studio uses *projects* to organize the code for an app, and *solutions* t
4345

4446
![Open the New Project dialog](media/vscpp-file-new-project.gif "Open the New Project dialog")
4547

46-
1. In the **New Project** dialog, select **Installed**, **Visual C++** if it isn't selected already, and then choose the **Empty Project** template. In the **Name** field, enter *HelloWorld*. Choose **OK** to create the project.
48+
1. In the **New Project** dialog, select **Installed > Visual C++** if it isn't selected already, and then choose the **Empty Project** template. In the **Name** field, enter *HelloWorld*. Choose **OK** to create the project.
4749

4850
![Name and create the new project](media/vscpp-concierge-project-name-callouts.png "Name and create the new project")
4951

50-
Visual Studio creates a new, empty project, ready for you to specialize for the kind of app you want to create and to add your source code files. You'll do that next.
52+
Visual Studio creates a new, empty project. It's ready for you to specialize for the kind of app you want to create and to add your source code files. You'll do that next.
5153

5254
[I ran into a problem.](#create-your-app-project-issues)
5355

5456
## Make your project a console app
5557

56-
Visual Studio can create all kinds of apps and components for Windows and other platforms. The **Empty Project** template isn't specific about what kind of app it creates. To create a *console app*, one that runs in a console or command prompt window, you must tell Visual Studio to build your app to use the console subsystem.
58+
Visual Studio can create all kinds of apps and components for Windows and other platforms. The **Empty Project** template isn't specific about what kind of app it creates. A *console app* is one that runs in a console or command prompt window. To create one, you must tell Visual Studio to build your app to use the console subsystem.
5759

5860
1. In Visual Studio, open the **Project** menu and choose **Properties** to open the **HelloWorld Property Pages** dialog.
5961

60-
1. In the **Property Pages** dialog, under **Configuration Properties**, select **Linker**, **System**, and then choose the edit box next to the **Subsystem** property. In the dropdown menu that appears, select **Console (/SUBSYSTEM:CONSOLE)**. Choose **OK** to save your changes.
62+
1. In the **Property Pages** dialog, select **Configuration Properties > Linker > System**, and then choose the edit box next to the **Subsystem** property. In the dropdown menu that appears, select **Console (/SUBSYSTEM:CONSOLE)**. Choose **OK** to save your changes.
6163

6264
![Open the Property Pages dialog](media/vscpp-properties-linker-subsystem.gif "Open the Property Pages dialog")
6365

@@ -106,39 +108,51 @@ When the code looks like this in the editor, you're ready to go on to the next s
106108
> [!div class="nextstepaction"]
107109
> [Build and run a C++ project](vscpp-step-2-build.md)
108110
109-
::: moniker range="<=vs-2017"
110-
111111
## Troubleshooting guide
112112
113113
Come here for solutions to common issues when you create your first C++ project.
114114
115-
### Create your app project issues
115+
### Create your app project - issues
116+
117+
::: moniker range="vs-2019"
118+
119+
The **New Project** dialog should show a **Console App** template that has **C++**, **Windows**, and **Console** tags. If you don't see it, there are two possible causes. It might be filtered out of the list, or it might not be installed. First, check the filter dropdowns at the top of the list of templates. Set them to **C++**, **Windows**, and **Console**. The C++ **Console App** template should appear; otherwise, the **Desktop development with C++** workload isn't installed.
120+
121+
To install **Desktop development with C++**, you can run the installer right from the **New Project** dialog. Choose the **Install more tools and features** link at the bottom of the template list to start the installer. If the **User Account Control** dialog requests permissions, choose **Yes**. In the installer, make sure the **Desktop development with C++** workload is checked. Then choose **Modify** to update your Visual Studio installation.
122+
123+
If another project with the same name already exists, choose another name for your project. Or, delete the existing project and try again. To delete an existing project, delete the solution folder (the folder that contains the *helloworld.sln* file) in File Explorer.
124+
125+
[Go back](#create-your-app-project).
126+
127+
::: moniker-end
128+
129+
::: moniker range="vs-2017"
116130
117-
If the **New Project** dialog doesn't show a **Visual C++** entry under **Installed**, your copy of Visual Studio probably doesn't have the **Desktop development with C++** workload installed. You can run the installer right from the **New Project** dialog. Choose the **Open Visual Studio Installer** link to start the installer again. If the **User Account Control** dialog requests permissions, choose **Yes**. In the installer, make sure the **Desktop development with C++** workload is checked, and choose **OK** to update your Visual Studio installation.
131+
If the **New Project** dialog doesn't show a **Visual C++** entry under **Installed**, your copy of Visual Studio probably doesn't have the **Desktop development with C++** workload installed. You can run the installer right from the **New Project** dialog. Choose the **Open Visual Studio Installer** link to start the installer again. If the **User Account Control** dialog requests permissions, choose **Yes**. Update the installer if necessary. In the installer, make sure the **Desktop development with C++** workload is checked, and choose **OK** to update your Visual Studio installation.
118132
119-
If another project with the same name already exists, choose another name for your project, or delete the existing project and try again. To delete an existing project, delete the solution folder (the folder that contains the helloworld.sln file) in File Explorer.
133+
If another project with the same name already exists, choose another name for your project. Or, delete the existing project and try again. To delete an existing project, delete the solution folder (the folder that contains the *helloworld.sln* file) in File Explorer.
120134
121135
[Go back](#create-your-app-project).
122136
123-
### Make your project a console app issues
137+
### Make your project a console app - issues
124138
125-
If you don't see **Linker** listed under **Configuration Properties**, choose **Cancel** to close the **Property Pages** dialog and then make sure that the **HelloWorld** project is selected in **Solution Explorer**, not the solution or another file or folder, before you try again.
139+
If you don't see **Linker** listed under **Configuration Properties**, choose **Cancel** to close the **Property Pages** dialog. Make sure that the **HelloWorld** project is selected in **Solution Explorer** before you try again. Don't select the **HelloWorld** solution, or another item, in **Solution Explorer**.
126140
127-
The dropdown control does not appear in the **SubSystem** property edit box until you select the property. You can select it by using the pointer, or you can press Tab to cycle through the dialog controls until **SubSystem** is highlighted. Choose the dropdown control or press Alt+Down to open it.
141+
The dropdown control doesn't appear in the **SubSystem** property edit box until you select the property. Click in the edit box to select it. Or, you can press **Tab** to cycle through the dialog controls until **SubSystem** is highlighted. Choose the dropdown control or press **Alt+Down** to open it.
128142
129143
[Go back](#make-your-project-a-console-app)
130144
131-
### Add a source code file issues
145+
### Add a source code file - issues
132146
133-
It's okay if you give the source code file a different name. However, don't add more than one source code file that contains the same code to your project.
147+
It's okay if you give the source code file a different name. However, don't add more than one file that contains the same code to your project.
134148
135-
If you added the wrong kind of file to your project, for example, a header file, delete it and try again. To delete the file, select it in **Solution Explorer** and press the Delete key.
149+
If you added the wrong file type to your project, such as a header file, delete it and try again. To delete the file, select it in **Solution Explorer**. Then press the **Delete** key.
136150
137151
[Go back](#add-a-source-code-file).
138152
139-
### Add code to the source file issues
153+
### Add code to the source file - issues
140154
141-
If you accidentally closed the source code file editor window, to open it again, double-click on HelloWorld.cpp in the **Solution Explorer** window.
155+
If you accidentally closed the source code file editor window, you can easily open it again. To open it, double-click on HelloWorld.cpp in the **Solution Explorer** window.
142156
143157
If red squiggles appear under anything in the source code editor, check that your code matches the example in spelling, punctuation, and case. Case is significant in C++ code.
144158

docs/build/vscpp-step-2-build.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
title: Build and run a C++ console app project
33
description: "Build and run a Hello World console app in Visual C++"
44
ms.custom: "mvc"
5-
ms.date: 12/12/2017
5+
ms.date: 04/20/2020
66
ms.topic: "tutorial"
77
ms.devlang: "cpp"
88
ms.assetid: 45138d71-719d-42dc-90d7-1d0ca31a2f55
99
---
1010
# Build and run a C++ console app project
1111

12-
When you've created a C++ console app project and entered your code, you can build and run it within Visual Studio, and then run it as a stand-alone app from the command line.
12+
You've created a C++ console app project and entered your code. Now you can build and run it within Visual Studio. Then, run it as a stand-alone app from the command line.
1313

1414
## Prerequisites
1515

1616
- Have Visual Studio with the Desktop development with C++ workload installed and running on your computer. If it's not installed yet, follow the steps in [Install C++ support in Visual Studio](vscpp-step-0-installation.md).
1717

18-
- Create a "Hello, World!" project and enter its source code. If you haven't done this yet, follow the steps in [Create a C++ console app project](vscpp-step-1-create.md).
18+
- Create a "Hello, World!" project and enter its source code. If you haven't done this step yet, follow the steps in [Create a C++ console app project](vscpp-step-1-create.md).
1919

2020
If Visual Studio looks like this, you're ready to build and run your app:
2121

@@ -41,11 +41,11 @@ Congratulations! You've created your first "Hello, world!" console app in Visual
4141

4242
Normally, you run console apps at the command prompt, not in Visual Studio. Once your app is built by Visual Studio, you can run it from any command window. Here's how to find and run your new app in a command prompt window.
4343

44-
1. In **Solution Explorer**, select the HelloWorld solution and right-click to open the context menu. Choose **Open Folder in File Explorer** to open a **File Explorer** window in the HelloWorld solution folder.
44+
1. In **Solution Explorer**, select the HelloWorld solution (not the HelloWorld project) and right-click to open the context menu. Choose **Open Folder in File Explorer** to open a **File Explorer** window in the HelloWorld solution folder.
4545

46-
1. In the **File Explorer** window, open the Debug folder. This contains your app, HelloWorld.exe, and a couple of other debugging files. Select HelloWorld.exe, hold down the Shift key and right-click to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard.
46+
1. In the **File Explorer** window, open the Debug folder. This folder contains your app, *HelloWorld.exe*, and a couple of other debugging files. Hold down the **Shift** key and right-click on *HelloWorld.exe* to open the context menu. Choose **Copy as path** to copy the path to your app to the clipboard.
4747

48-
1. To open a command prompt window, press Windows-R to open the **Run** dialog. Enter *cmd.exe* in the **Open** textbox, then choose **OK** to run a command prompt window.
48+
1. To open a command prompt window, press **Windows+R** to open the **Run** dialog. Enter *cmd.exe* in the **Open** textbox, then choose **OK** to run a command prompt window.
4949

5050
1. In the command prompt window, right-click to paste the path to your app into the command prompt. Press Enter to run your app.
5151

@@ -57,23 +57,25 @@ Congratulations, you've built and run a console app in Visual Studio!
5757

5858
## Next Steps
5959

60-
Once you've built and run this simple app, you're ready for more complex projects. See [Using the Visual Studio IDE for C++ Desktop Development](../ide/using-the-visual-studio-ide-for-cpp-desktop-development.md) for more detailed walkthroughs that explore the capabilities of Visual C++ in Visual Studio.
60+
Once you've built and run this simple app, you're ready for more complex projects. For more information, see [Using the Visual Studio IDE for C++ Desktop Development](../ide/using-the-visual-studio-ide-for-cpp-desktop-development.md). It has more detailed walkthroughs that explore the capabilities of Microsoft C++ in Visual Studio.
6161

6262
## Troubleshooting guide
6363

6464
Come here for solutions to common issues when you create your first C++ project.
6565

66-
### Build and run your code in Visual Studio issues
66+
### Build and run your code in Visual Studio - issues
6767

6868
If red squiggles appear under anything in the source code editor, the build may have errors or warnings. Check that your code matches the example in spelling, punctuation, and case.
6969

7070
[Go back.](#build-and-run-your-code-in-visual-studio)
7171

72-
### Run your code in a command window issues
72+
### Run your code in a command window - issues
7373

74-
You can also navigate to the solution Debug folder at the command line to run your app. You can't run your app from other directories without specifying the path to the app. However, you can copy your app to another directory and run it from there.
74+
If the path shown in File Explorer ends in *\\HelloWorld\\HelloWorld*, you've opened the HelloWorld *project* instead of the HelloWorld *solution*. You'll be confused by a Debug folder that doesn't contain your app. Navigate up a level in File Explorer to get to the solution folder, the first *HelloWorld* in the path. This folder also contains a Debug folder, and you'll find your app there.
7575

76-
If you don't see **Copy as path** in the shortcut menu, dismiss the menu, and then hold down the Shift key while you open it again. This is just for convenience. You can also copy the path to the folder from the File Explorer search bar, and paste it into the **Run** dialog, and then enter the name of your executable at the end. It's just a little more typing, but it has the same result.
76+
You can also navigate to the solution Debug folder at the command line to run your app. Your app won't run from other directories without specifying the path to the app. However, you can copy your app to another directory and run it from there. It's also possible to copy it to a directory specified by your PATH environment variable, then run it from anywhere.
77+
78+
If you don't see **Copy as path** in the shortcut menu, dismiss the menu, and then hold down the **Shift** key while you open it again. This command is just for convenience. You can also copy the path to the folder from the File Explorer search bar, and paste it into the **Run** dialog, and then enter the name of your executable at the end. It's just a little more typing, but it has the same result.
7779

7880
[Go back.](#run-your-code-in-a-command-window)
7981

0 commit comments

Comments
 (0)