It is very common to group projects, for example, place test projects under the /test
folder and source projects under the /src
folder. Add global.json
file and make similar structure:
global.json
/src/
/MyProject.Core/
SourceFile.cs
project.json
/MyProject.Web/
/Controllers
/Views
project.json
/test/
/MyProject.Core.UnitTests/
SourceFileTest.cs
project.json
/MyProject.Web.UnitTests/
/Controllers
/Views
project.json
Edit empty global.json
file and specify project groups:
{
"projects":["src", "test"]
}
VS Code uses tasks.json
to run tasks (e.g. building a solution) and launch.json
for starting a project (e.g. debugging).
If you cannot find these files try to start debugging by pressing F5 and ignore errors, VS Code will generate under the root folder .vscode
folder with the files.
Edit launch.json
file and specify the path to your start up library, change MyProject.Web
with your project name:
{
"configurations": [
{
...
"program": "${workspaceRoot}/src/MyProject.Web/bin/Debug/netcoreapp1.0/MyProject.Web.dll",
"args": [],
"cwd": "${workspaceRoot}/src/Washita.Web",
...
}
}
Edit tasks.json
file and specify the path to your start up library, change MyProject.Web
with your project name:
{
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}/src/MyProject.Web"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
Now you should be able to build and debug .NET source files.
However Intellisense will disappear due the multiple project configuration. To fix it open any .cs
file and switch to the appropriate project (project.json) by choosing Select project
in the bottom right corner: