Build Type

18 views
Skip to first unread message

Dan Allen

unread,
Feb 21, 2026, 8:33:00 AM (2 days ago) Feb 21
to Excel-DNA
Hi,

I am creating an addin using ExcelDNA and it seems to be going well. However, I am using VSCode rather than Visual Studio.

I'm at the stage where I am trying to compile a release build and have just discovered that the build task in the "tasks.json" file does not appear to be used when I build the project. So I'm confused as to which task is being used in the configuration for "preLaunchTask" within the "launch.json" file which is set to debug. Is there a hidden one somewhere?

Basically when I build currently the command line in terminal shows "dotnet build {MyProject.sln} /property:GenerateFullPaths=true /p:Configuration=Debug /p:Platform=Any CPU /consoleloggerparameters:NoSummary".

How do I generate a configuration for release?

Thanks.

Govert van Drimmelen

unread,
Feb 21, 2026, 8:40:31 AM (2 days ago) Feb 21
to exce...@googlegroups.com

Hi Dan,

 

I asked my ChatGPT and the answer looks pretty good to me (though my own VS Code expertise is rather flimsy).

Below is what it offered. If you’re still stuck, please write back and I can help further.

-Govert


====================================


What you’re seeing is normal for VS Code: launch.json’s preLaunchTask is only used when you start debugging, and the default “build” you’re getting is usually coming from the C# extension’s built-in build command, not necessarily the tasks.json task you wrote.

So there usually isn’t a “hidden task” file—there’s a built-in build action (OmniSharp / C# Dev Kit depending on what you installed) that runs something like the command you pasted.

1) Confirm what VS Code is building (and whether it’s your task)

A. When you press Ctrl+Shift+B

That runs the default build task (if you have one). If you don’t, VS Code may prompt you, or an extension may supply a default.

Open .vscode/tasks.json and make sure you actually have:

  • a task with "label": "build" (or whatever you want),
  • and that it’s marked as the default build task.

Example:

{

  "version": "2.0.0",

  "tasks": [

    {

      "label": "build (Debug)",

      "type": "process",

      "command": "dotnet",

      "args": [

        "build",

        "${workspaceFolder}/MyProject.sln",

        "/p:GenerateFullPaths=true",

        "/p:Configuration=Debug",

        "/p:Platform=Any CPU",

        "/consoleloggerparameters:NoSummary"

      ],

      "problemMatcher": "$msCompile",

      "group": { "kind": "build", "isDefault": true }

    }

  ]

}

If you don’t have "group": { "kind": "build", "isDefault": true }, VS Code might not use it when you do a “build”.

B. When you press F5 (debug)

That runs:

  • your selected configuration in launch.json
  • and only if preLaunchTask matches a task label in tasks.json, it will run that task.

If preLaunchTask is set to "debug" but you don’t have a task with "label": "debug", VS Code usually shows an error like “could not find the task”.

So: check launch.json and ensure the preLaunchTask string exactly equals a tasks.json "label".

Example:

{

  "configurations": [

    {

      "name": "Debug Excel",

      "type": "coreclr",

      "request": "launch",

      "preLaunchTask": "build (Debug)"

    }

  ]

}

2) Build Release from the terminal (quickest, zero VS Code plumbing)

From the workspace root:

dotnet build .\MyProject.sln -c Release

If you also want to force platform:

dotnet build .\MyProject.sln -c Release -p:Platform="Any CPU"

That’s the simplest reliable way to confirm Release works before wiring tasks.

3) Add a Release build task in tasks.json

Add a second task:

{

  "label": "build (Release)",

  "type": "process",

  "command": "dotnet",

  "args": [

    "build",

    "${workspaceFolder}/MyProject.sln",

    "/p:GenerateFullPaths=true",

    "/p:Configuration=Release",

    "/p:Platform=Any CPU",

    "/consoleloggerparameters:NoSummary"

  ],

  "problemMatcher": "$msCompile",

  "group": "build"

}

Now you can run:

  • Terminal → Run Task… → build (Release)
  • or set it as the default build task.

4) If you want F5 to still debug, but you want “Release” sometimes

Two common patterns:

Pattern A: Debug always uses Debug build (recommended)

Keep preLaunchTask = "build (Debug)".
Use the Release task only when packaging / publishing.

Pattern B: Add a second launch configuration for Release

You typically don’t debug Release, but sometimes you want to launch Excel with a Release-built add-in.

{

  "name": "Launch Excel (Release build)",

  "type": "coreclr",

  "request": "launch",

  "preLaunchTask": "build (Release)"

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/exceldna/bebd2cac-57b9-44cb-a503-c78b2430c70en%40googlegroups.com.

Dan Allen

unread,
Feb 21, 2026, 9:45:50 AM (2 days ago) Feb 21
to Excel-DNA
Hi Govert,

Thanks for the response.

I think I have figured it out now. I am using "C# Dev Kit" and it does look like the task that is created with the project and shown within "tasks.json" is not actually used. It is a default version called "dotnet:build" that is used. This only seems to show in "tasks.json" if you click the cog icon to edit it. However, there appears to be very limited options available.

The default task is simply as follows:

"type": "dotnet",
"task": "build",
"group": "build",
"problemMatcher": [],
"label": "dotnet: build"

It appears that the correct way to set the build type for "C# Dev Kit" is to actually issue a command to dotnet that sets it (so it isn't really part of the project). I have tested it for now by using the ".NET: Select a Configuration..." option from the command palette and it was successful. There appears to be some command line methods so I need to look at trying to automate it as part of my project, if possible.

Thanks again for the help. It sent me along the right path!

Reply all
Reply to author
Forward
0 new messages