How to fix ‘Unable the find the project that contains {path}’ when running c# code in VScode.
I have recently created a new c# project using
dotnet new console
But when running using the run button in the top left, I get a warning message saying
‘Unable to find the project that contains {file path}’ , source: c# Dev Kit
I am able to run programs created more than 2 days ago, but I cannot create new ones.
Using dotnet run works, and the program runs as intended but neither running with the run button works nor automatic error highlighting.
2
Answers
Did you create launch.json and tasks.json files?
launch.json
is used to launch an app for debugging. E.gtasks.json
is used to configure scripts and start processes. E.gYou can also take a look here
https://code.visualstudio.com/docs/editor/debugging
https://code.visualstudio.com/docs/csharp/debugging
FWIW, when running into this same error in VS Code on Windows, it turned out that I had the wrong version of the .NET SDK installed. You might try getting the latest update for that and see if it resolves the issue.