'Run a task after dotnet watch runs a project

Is it possible to setup a task to run after the dotnet watch process has finished building and running an asp.net api project? I would only want this task to run when the api project is running, not when building, because the code generation requires a running site to point at the swagger.json file.

The solution structure is as follows:

dotnet/
  /api
  /codegen
  /e2etest
  /csclient
client/
  /tsclient

Process flow would be Listen for changes, when a change occurs, build and run the api project, run the codegen project



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source