-
Notifications
You must be signed in to change notification settings - Fork 0
Tasks defined in subdirectories
A tasks file (dotnet-tasks.yml) makes tasks available to that directory and all directories within it. If you wish to add extra tasks or override a task definition in a subdirectory you may add another tasks file (dotnet-tasks.yml) to that sub-directory.
Assume the following tasks already defined at a parent directory:
~/project$ dotnet do --list
Tasks available from this directory:
build Builds the entire application stack.
run, start Builds and runs the entire application stack.
To do add additional tasks called build-tests for a "tests" subdirectory, navigate to "tests" subdirectory and execute:
dotnet do --create
Then modify the created dotnet-tasks.yml file to add the task:
tasks:
- name: build-tests
- description: Build the unit tests.
- run: dotnet build tests.csproj
- working-directory: ./The new task will now be available from the "tests" directory and it's subdirectories and not it's parent or sibling directories.
~/project/tests$ dotnet do --list
Tasks available from this directory:
build-tests Build the unit tests.
build Builds the entire application stack.
run, start Builds and runs the entire application stack.
Assume the following tasks already defined at a parent directory:
~/project$ dotnet do --list
Tasks available from this directory:
build Builds the entire application stack.
run, start Builds and runs the entire application stack.
To override the run task for a "tests" subdirectory, navigate to "tests" subdirectory and execute:
dotnet do --create
then modify the created dotnet-tasks.yml file to add the task:
tasks:
- name: run
- description: Run the unit tests.
- run: dotnet run tests.csproj
- working-directory: ./The new task will now be available from the "tests" directory and it's subdirectories and not it's parent or sibling directories, furthermore, the existing run task name is reassigned to the task define in this directory.
~/project/tests$ dotnet do --list
Tasks available from this directory:
run Run the unit tests.
build Builds the entire application stack.
start Builds and runs the entire application stack.