✅ How to run the active file on VS Code
So basically I have a 2 folders with different projects, one is ConsoleApp1 and one is StudentGPACalc, when I run StudentGPACalc using Ctrl+F5, it runs ConsoleApp1 instead. But when I use the run button on top left saying "Run project associated with this file", it runs my actively editing file. I want to use Ctrl+F5 to run my actively editing project. How to do it? Whenever I do Ctrl+F5 on my active file, the terminal keeps providing me solution of ConsoleApp1

13 Replies
I use Vstudio for .NET, but looking online with google it looks like you have to use dotnet run from the terminal to run your project. Ctrl+F5 always runs the active file in VS Code. That's just how it works. If you want Ctrl+F5 to run your project, use Visual Studio instead
actually, digging further: https://dotnet.microsoft.com/en-us/learn/dotnet/hello-world-tutorial/run
Microsoft
.NET Tutorial - Hello World in 5 minutes | .NET
Step-by-step instructions and videos for installing .NET and building your first Hello World .NET application. Develop with free tools for Linux, macOS, and Windows.
you almost certainly have created a launch profile when you first hit
Ctrl+F5
. that profile is tied to exactly one projectbest you can really do is assign some keybind to this command

i wouldn't recommend unbinding ctrl+f5 to replace the default behavior, you'll probably want to use launch profiles at some point
oh aight
well, it says this

that's what i'm getting as well, i'm opening an issue
and for some reason this works

but not the shortcut
give it a thumbs up if you want https://github.com/microsoft/vscode-dotnettools/issues/2140
aight
Thanks
for now i suppose you'll have to click manually. i'm not sure if launch profiles can be configured to launch the currently loaded project