Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No C# project is currently loaded" in Visual Studio Code when debugging

I only get such an error when I press F5(run) in C#, all libraries are installed, .Net is installed. I deleted the app and reinstalled it but it didn't work.

Can you help me?(

enter image description here

No C# project is currently loaded. Please create a C# project in order to debug.

Source: C# Dev Kit (Extension)

When I press F5, the code does not work and I get an error as in the picture

like image 474
imnotarobot Avatar asked Nov 27 '25 12:11

imnotarobot


2 Answers

To set up build and debug assets in your .NET project:

  1. Open the Command Palette: Press Ctrl + Shift + P.
  2. Select the Command: Type and select >.NET: Generate Assets for Build and Debug.
  3. Enable Debugging: On the left sidebar, click on the Debug button located above the Extensions icon.

You should now be all set to start debugging!

like image 91
Babar Zaman Avatar answered Nov 29 '25 03:11

Babar Zaman


In my case I was following a couple different (older) walk throughs that used a mix of Command Pallet commands to create the C# project and solution.

dotnet new console
dotnet new sln

In the terminal I could run the project.

dotnet run

But I could not debug. Then I figured out that the "project" was not associated with the "solution". At the bottom of the Explorer pane open the Solution Explorer. If necessary, create a folder and then right click and Add Existing Project... Choose the csproj file in your directory and save everything.

VSCode Solution Explorer | Add Existing Project

Return to the Run and Debug tab and hit [F5].

like image 40
Matthew McDermott Avatar answered Nov 29 '25 04:11

Matthew McDermott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!