Reputation: 21
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.
Upvotes: 2
Views: 10649
Reputation: 97
You might have confused Visual Studio (an IDE) with Visual Studio Code (more of a code editor). The two are not the same thing. I had the same problem in this tutorial for example: https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio
I simply could not find the "new project" button in visual studio code.
Upvotes: 1
Reputation: 1412
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:
Program.cs
, dotnet.csproj
and obj
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
.
Upvotes: 0
Reputation: 83577
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.
Upvotes: 0
Reputation: 36
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.
Upvotes: 0