How do I make a C# Console app build and debug in Visual Studio Code?
I have already built my C# Console App in Visual Studio Code. The issue I have is when I reopen the folder where the project file is in Visual Studio Code and then rebuilding the code and debugging it again.
Here is what I do and what happens. After I open the folder where the project file resides, I click on this to process the code to debug:
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 0 7 . p n g
(Icon showing the option to debug a solution)
And then I click on the appearing "Run and Debug" button
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 0 8 . p n g
(image of the Solution Explorer panel with a buttin of "Run and Debug)
But then the bottom status bar says "Looking for CSS classes in the workspace..." followed by a percentage in paragraphs. Why is this? Why does this happen when there are no CSS classes at all and my project is a C# project?
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 0 9 . p n g
(image of the status bar that appears at the bottom that says "Looking for CSS classes in the workspace..."
Why is this? This is just a brief snapshot of some difficulties I find when I reopen a project after I have closed Visual Studio Code. I have experienced other errors and problems in building and running my code.
To continue, in order to deal with the project as a solution, I click on this icon to open the solution panel.
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 1 0 . p n g
This seemingly allows me to view the solution. As the following view appears, I click on the project.cs file and attempt a debugging session from there.
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 1 1 . . . p n g
With this file being displayed, I clicked on the menu option, Run -> Start Debugging
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 1 2 . . . p n g
Then, at this point, in the pop up option window that appears in the middle and top of the development environment, I pick "C#":
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 1 3 . . . p n g
Something went wrong and in the bottom right of my IDE, I get this message:
h t t p s : / / l i k a b l e l o g i c . o r g / i m a g e s / l o s t / 1 4 . p n g
Please advise. What should I do now?

Tuhin PaulPosted Jan 27, 2025, 2:40 PM
You're having difficulties rebuilding and debugging your C# Console application in Visual Studio Code after reopening the project
Configure VS Code for Building and Debugging
Check the C# Extension is Installed:
Open the Extensions view (
Ctrl + Shift + X).Search for "C#" and install the official C# extension by Microsoft.
Create a
launch.jsonFile:Open the Command Palette (
Ctrl + Shift + P).Search for and select
.NET: Generate Assets for Build and Debug.This will create two files in the
.vscodefolder:launch.json: Configures debugging.tasks.json: Configures build tasks.Verify
launch.json: Open.vscode/launch.jsonand it looks like this:Replace
net8.0with the .NET version you're using (e.g.,net6.0ornet7.0).Verify
tasks.json:Open
.vscode/tasks.jsonand it looks like this:Build and Debug the Project
Build the Project: use the
Tasks: Run Build Taskoption in the Command Palette (Ctrl + Shift + P).Regarding the "Looking for CSS classes" message, this is likely caused by an unrelated extension. You can ignore it for your C# project, or you can disable CSS-related extensions if they're not needed.
Missing
.vscodeFolderIf the
.vscodefolder is missing, run the.NET: Generate Assets for Build and Debugcommand again.If you're still experiencing issues, please provide the contents of your `.csproj` file and any error messages you see in the "Output" or "Debug Console" panels when trying to debug.