https://github.com/imaun/vscode-mutliple-project
How to Build and Debug multiple .NET projects in Visual Studio Code (vscode)
https://github.com/imaun/vscode-mutliple-project
Last synced: about 2 months ago
JSON representation
How to Build and Debug multiple .NET projects in Visual Studio Code (vscode)
- Host: GitHub
- URL: https://github.com/imaun/vscode-mutliple-project
- Owner: imaun
- License: mit
- Created: 2022-05-08T10:16:40.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-08T12:27:37.000Z (about 3 years ago)
- Last Synced: 2025-02-05T19:50:35.708Z (3 months ago)
- Language: C#
- Size: 289 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vscode-mutliple-project
How to Build and Debug multiple .NET projects in Visual Studio Code (vscode)Suppose we have mutliple projects with a structure like this :
```
- src
- SampleProject.Api
- SampleProject.Api.csproj
- SampleProject.Console
- SampleProject.Console.csproj
- SampleProject.Lib
- SampleProject.Lib.csproj
```Note that we don't have a solution file here. But with a solution, it's not very different.
- Create a directory named `.vsocde` in your working directory root.
- Create a file inside `.vscode` and name it `tasks.json` -> [task.json](https://github.com/imaun/vscode-mutliple-project/blob/master/.vscode/tasks.json)
- Create another file inside `.vscode` and name it `launch.json` -> [launch.json](https://github.com/imaun/vscode-mutliple-project/blob/master/.vscode/tasks.json)For debugging .NET application we must install `omnisharp` plugin on vscode.
## Tasks
```json
{
"version": "2.0.0",
"tasks": [
{
"label": "build Lib",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"${workspaceFolder}/src/SampleProject.Lib"
],
"problemMatcher": [
"$msCompile"
],
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "build Api",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"${workspaceFolder}/src/SampleProject.Api"
],
"problemMatcher": "$msCompile",
"presentation": {
"reveal": "always"
},
"group": "build"
},
{
"label": "build Console",
"command": "dotnet",
"type": "shell",
"args": [
"build",
"${workspaceFolder}/src/SampleProject.Console"
],
"problemMatcher": "$msCompile",
"presentation": {
"reveal": "always"
},
"group": "build"
}
]
}```
## Launch
```json
{
"configurations": [
{
"name": "Api",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build Api",
"program": "${workspaceFolder}/src/SampleProject.Api/bin/Debug/net6.0/SampleProject.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/src/SampleProject.Api",
"stopAtEntry": false,
"console": "externalTerminal"
},
{
"name": "Console",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build Console",
"program": "${workspaceFolder}/src/SampleProject.Console/bin/Debug/net6.0/SampleProject.Console.dll",
"args": [],
"cwd": "${workspaceFolder}/src/SampleProject.Console",
"stopAtEntry": false,
"console": "integratedTerminal"
}],
"compounds": [
{
"name": "Debug All",
"configurations": [
"Api",
"Console"
]
}
]
}
```Now we can go to `Debug` tab and debug one or all our applications we already definded in `launch.json` file.
----