- [Сustomize the Default Build Task](#сustomize-the-default-build-task) - [Create Multiple Tasks](#create-multiple-tasks) - [Customize preLaunchTask](#customize-prelaunchtask) - [Create Multiple Launch Cnfigurations](#create-multiple-launch-cnfigurations) ## Сustomize the Default Build Task To customize the default build task, preform the following steps: 1. In the VSCode, open command palette (`ctrl + shift + P` on Windows/Linux, `command + shift + P` on MacOS). 2. In the opened panel, type in the `Configure Default Build Task`: ![](img/img1.png) 3. Select `dotnet-meteor: Build` from the list: ![](img/img2.png) This will add the `tasks.json` file to your project: ```json { "version": "2.0.0", "tasks": [ { "type": "dotnet-meteor.task", "problemMatcher": [], "label": "dotnet-meteor: Build", "group": { "kind": "build", "isDefault": true } } ] } ``` 1. Specify a custom pre-build parameter in the `args` section of the `tasks.json` file. ```json "type": "dotnet-meteor.task", "problemMatcher": [], "label": "dotnet-meteor: Build", "args": [ "-p:MyCustomBuildOption=value" ], "group": { "kind": "build", "isDefault": true } ``` ## Create Multiple Tasks You can duplicate the default build task and change any of the task setting. The following code snippet contains the default and custom publish tasks: ```json { "version": "2.0.0", "tasks": [ { //Default build task "type": "dotnet-meteor.task", "problemMatcher": [], "label": "dotnet-meteor: Build", "group": { "kind": "build", "isDefault": true } }, { //Custom publish task "type": "dotnet-meteor.task", "problemMatcher": [], "args": [ "-p:MyReleaseProperty=value" ], "label": "Custom publish task" } ] } ``` To run the custom build task, type in the `Run Task` in the VSCode command palette, and choose the task: ![](img/img3.png) ## Customize preLaunchTask 1. Create the [launch.json](https://github.com/JaneySprings/DotNet.Meteor/blob/main/README.md) file. The following code sample contains its default content: ```json { "version": "0.2.0", "configurations": [ { "name": ".NET Meteor Debugger", "type": "dotnet-meteor.debugger", "request": "launch", "preLaunchTask": "dotnet-meteor: Build" } ] } ``` 1. You can set the `preLaunchTask`'s value to your task's name. The following code sample defines a new task in the `tasks.json` file: ```json { "version": "2.0.0", "tasks": [ { "type": "dotnet-meteor.task", "problemMatcher": [], "label": "My custom task", "args": [ "-p:MyCustomProperty=value" ], } ] } ``` 1. Now you can register this task in the `launch.json` file to run it before the application startup: ```json { "version": "0.2.0", "configurations": [ { "name": ".NET Meteor Debugger", "type": "dotnet-meteor.debugger", "request": "launch", "preLaunchTask": "My custom task" } ] } ``` 2. *Optional step*. You can remove the `preLaunchTask` parameter and build the project only when you call the build command: ```json { "version": "0.2.0", "configurations": [ { "name": ".NET Meteor Debugger", "type": "dotnet-meteor.debugger", "request": "launch" } ] } ``` ## Create Multiple Launch Configurations You can lanch multiple launch configurations for different run scenarios: ```json { "version": "0.2.0", "configurations": [ { "name": ".NET Meteor (no build)", "type": "dotnet-meteor.debugger", "request": "launch" }, { "name": ".NET Meteor (custom build)", "type": "dotnet-meteor.debugger", "request": "launch", "preLaunchTask": "My custom task" }, { "name": ".NET Meteor (pair to Mac)", "type": "dotnet-meteor.debugger", "request": "launch", "preLaunchTask": "My custom task 2" } ] } ``` Open the side bar's `Run and debug` tab and select a launch configuration from the drop-down list: ![](img/img4.png)