cash
cash

Reputation: 565

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",                
        }
    ]
}

Upvotes: 4

Views: 5817

Answers (1)

ycansener
ycansener

Reputation: 361

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.

Upvotes: 1

Related Questions