# VS Code: Defining tasks.json for debugging

**URL:** <https://forums.fsharp.org/t/vs-code-defining-tasks-json-for-debugging/3352>\
**Category:** General\
**Created:** [September 23, 2023, 4:29pm UTC](https://forums.fsharp.org/t/vs-code-defining-tasks-json-for-debugging/3352 "2023-09-23T16:29:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellipticview](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/ellipticview/32/1234_2.png) [@ellipticview](https://forums.fsharp.org/u/ellipticview)\
**Post date:** [September 23, 2023, 4:29pm UTC](https://forums.fsharp.org/t/vs-code-defining-tasks-json-for-debugging/3352/1 "2023-09-23T16:29:07Z")

</div>

As a beginner to FSharp I am trying to setup VS Code on MacOS for debugging.  
I have followed the instructions on [Ionide](https://ionide.io/Editors/Code/getting_started.html)  
I have VS Code, with the OmniSharp and Ionide plugins.

I also looked at these instructions: [Debug F# in Visual Studio Code on OSX (and Linux?) targeting dotnet core · GitHub](https://gist.github.com/erikkinding/68e470f808a82c4daf7950669e5bd178)

My launch.json looks like this:

```auto
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net7.0/ProjectName.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "console": "internalConsole"
        }
    ]
}

```

Now I’m trying to configure the “preLaunchTask”: “build”.  
I press Cmd-Shift-P and select:

```auto
Tasks: Configure Task

```

I then select this from the list:

```auto
Build: ProjectName.fsproj
Build the ProjectName.fsproj project using dotnet build

```

This results in the following tasks.json:

```auto
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "msbuild",
			"problemMatcher": [
				"$msCompile"
			],
			"group": "build",
			"label": "Build: ProjectName.fsproj",
			"detail": "Build the ProjectName.fsproj project using dotnet build"
		}
	]
}

```

Note that this file does not have a task with label `build`.

Now I choose Run \> Start Debugging and the message comes up: Could not find the task ‘build’.  
I can then choose:

- Debug anyway (this does work)
- Configure task. This brings me to a previous dialogue: “Select a task to configure”.

So my question is: How do I configure my task? The page referred to above suggests to select `.NET Core` from the task configuration list, but I do not see this option.

---

<div class="post-metadata">

**Author:** ![Martin521](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/martin521/32/1179_2.png) [@Martin521](https://forums.fsharp.org/u/Martin521)\
**Post date:** [September 24, 2023, 12:27pm UTC](https://forums.fsharp.org/t/vs-code-defining-tasks-json-for-debugging/3352/2 "2023-09-24T12:27:27Z")

</div>

You can choose “create task from template” (not sure if I remember the wording correctly) and then .Net build.

---

<div class="post-metadata">

**Author:** ![andrewreeman](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/andrewreeman/32/1342_2.png) [@andrewreeman](https://forums.fsharp.org/u/andrewreeman)\
**Post date:** [December 7, 2024, 7:31pm UTC](https://forums.fsharp.org/t/vs-code-defining-tasks-json-for-debugging/3352/3 "2024-12-07T19:31:39Z")

</div>

I created the task the same way as you. But then copied the same label to `"preLaunchTask"` in `launch.json`  
So my launch json looked like this:

```json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": ".NET Core Launch (console)",
      "type": "coreclr",
      "request": "launch",
      "preLaunchTask": "Build: helloworld.fsproj",
      "program": "${workspaceFolder}/bin/Debug/net8.0/helloworld.dll",
      "args": [],
      "cwd": "${workspaceFolder}",
      "stopAtEntry": false,
      "console": "internalConsole"
    }
  ]
}

```
