Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a .NET project as StartUp in VS Code?

I'm using VS Code with the vscode-solution-explorer to develop a .NET solution.

For debugging, I've configured my .vscode/launch.json file to run a build solution task and to execute a specific C# project (.csproj file).

My problem is: this .NET solution uses the Microservices approach, so I have ~50 Web API projects and each time I need to debug a specific API, I need to open the .vscode/launch.json file and replace the project name in 4 different places.

What I would like to do is the same that I do in Visual Studio: I right-click in the project and select "Set as StartUp project", so every time I press F5 it will run this selected project.

My launch.json looks likes this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "MyProject",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/MyProject/bin/Debug/netcoreapp3.0/MyProject.dll",
            "args": [],
            "cwd": "${workspaceFolder}/MyProject.csproj",                
        }
    ]
}
like image 611
cash Avatar asked Dec 04 '25 21:12

cash


1 Answers

You can create multiple configurations in launch.json file. Check this post: How do I designate a startup project in VS Code?

Hope this helps.

like image 158
ycansener Avatar answered Dec 07 '25 10:12

ycansener



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!