Hi, I believe you are experiencing the same VSCode bug that I have been experiencing. I just made a PR today to fix this:
Right now, when validating an executable, the check to ensure the path is a file and not a directory comes before the check for executables in PATH. This means that a sub directory of the current p...
github.com
Some people suggest that a workaround is to change the task type to "shell" instead of "process".
See:
Fix Visual Studio Code build task give 'The terminal shell path “dotnet” is a directory' See: https://stackoverflow.com/questions/58072505/visual-studio-code-build-task-give-the-terminal-sh...
github.com
Issue Description Cant run "build" task because "The preLaunchTask 'build' terminated with exit code -2." I've narrowed it down to the following The terminal shell path "dotnet" is a directory. Cha...
github.com
The error message has changed since these posts were made in 2019, however, the issue should be the same. Hopefully the temporary fix works for you while we wait for the PR to be merged.