'Cant find where to start a new project
I have recently installed Visual Studio Code (version 1.44.2) and I cant figure out how to start a new project.
I've looked through tutorials and articles on how to do so, but most all of these sources mention a clear button that states Start a new project. I cannot find this button on the welcome page, or anywhere else for that matter.
Nothing seems to work, and the Create new folder button only brings up a text document. But when I select a language—using a small button in the bottom right hand corner—and try to debug, run, or compile the program the Run and Debug buttons are grayed out.
Solution 1:[1]
You need to save the file with the extension of the language you are using (.py for Python, .cpp for C++, and so on). Also, go to the marketplace and download plugins related to that language. How to actually run the code depends on the plugin itself, so make sure to check the documentation. However, if you need to just run snippets of code for interpreted languages, you can use the terminal (ctrl + shift + `). For that, I would recommend setting up a keyboard shortcut for "Run Selected Text In Active Terminal" in the settings at the bottom left.
Solution 2:[2]
Visual Studio Code does not have a "Start a new project" option anywhere that I know. Instead, you create a new folder and place your code files in that project. You should be very careful when reading tutorials. Be sure you are not looking at ones Visual Studio Code not for Visual Studio. These are two different things.
Solution 3:[3]
To create a .NET template, this tutorial suggests to run dotnet commands on shell
Solution 4:[4]
The original post tags which were edited from visual-studio to visual-studio-code and the reference to a Start a new project button seems to indicate some confusion between those two applications. Maybe those tutorials were intended for visual-studio not visual-studio-code.
I've just tried the following simple tutorial and it works as intended. Perhaps it could help you figure out what you have to do.
Basically, all you have to do is:
- Create a new folder for you project, let it be empty for now.
- Right-click on it to choose "Open with Code" in context menu (if your OS lack such option, you can simply type code <name_of_the_new_folder> in your favorite shell). Once vscode is up, choose menu 'Terminal > New Terminal'
- In the newly opened terminal in vscode, type 'dotnet new console'
you should now have two files and a folder in your project folder:
Program.cs
,dotnet.csproj
andobj
- Open the explorer view (ctrl+shift+E) and open the file
Program.cs
.
This should trigger the download of a few things depending of what your installation already include.
A new folder bin
should appear in your project folder.
At the same time, a window should appear at the bottom right of vscode window saying: Required assets to build and debug are missing from 'dotnet'. Add them? Click Yes.
Once done, you should have a new folder: .vscode
. In there you'll find a launch.json
file which contains some directives that enable the run button you find in the 'Run view' (ctrl+shift+D).
Clicking this run button will start your application in debugging mode.
Choose menu 'Run > Run Without Debugging' to just run your application. Alternatively, you can use
dotnet run
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sv-albert |
Solution 2 | Code-Apprentice |
Solution 3 | aless80 |
Solution 4 |