This will require OSX and ZSH installed.
For tests it will require your directory name to match your namespace for tests as it uses the directory name to pass the namespace to xunit
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "0.1.0", | |
"command": "zsh", | |
"isShellCommand": true, | |
"showOutput": "always", | |
"args": [ | |
"-c" | |
], | |
"options": { | |
"cwd": "${fileDirname}" | |
}, | |
"tasks": [ | |
{ | |
"taskName": "Build Current Project", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"setopt extended_glob && print -l (../)#project.json(:h) | xargs dotnet build 2>&1 | grep -iv warning && echo Build Current Project Completed" | |
], | |
"problemMatcher": "$msCompile" | |
}, | |
{ | |
"taskName": "Build All Projects", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"cd ${workspaceRoot} && dotnet build ./**/**/project.json && echo Build All Completed" | |
], | |
"problemMatcher": "$msCompile" | |
}, | |
{ | |
"taskName": "Restore All Projects", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"cd ${workspaceRoot} && dotnet restore ./**/**/project.json --verbosity Information && echo Restore All Completed" | |
] | |
}, | |
{ | |
"taskName": "Restore Current Project", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"setopt extended_glob && print -l (../)#project.json(:h) | xargs dotnet restore --verbosity Information && echo Restore Current Project Completed" | |
] | |
}, | |
{ | |
"taskName": "Run All Tests in Project", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"setopt extended_glob && print -l (../)#project.json(:h) | xargs dotnet test && echo Tests Run Completed" | |
], | |
"problemMatcher": "$msCompile" | |
}, | |
{ | |
"taskName": "Run Tests in Class", | |
"suppressTaskName": true, | |
"isBuildCommand": true, | |
"args": [ | |
"setopt extended_glob && print -l (../)#project.json(:h) | xargs -I@ dotnet test @ -class $(echo ${fileDirname} | sed 's/.*src\\///g' ).$(basename ${file} .cs) && echo Tests Run Completed" | |
], | |
"problemMatcher": "$msCompile" | |
} | |
] | |
} |