'C# - VS Code - launch:program ... does not exist

I am trying to debug a simple "Hello world" application in VS Code, however, when I press Ctrl + F5, it gives me the following error:

enter image description here

If I manually change the path in launch.json from:

${workspaceFolder}/bin/Debug/insert-target-framework-here/insert-project-name-here.dll

To:

"${workspaceFolder}/bin/Debug/netcoreapp2.1/test.dll"

It does work, however before it was working fine without me manually typing the path. Also, I have noticed that VS Code no longer asks to rebuild assets like it did before:

enter image description here

So far I have tried the following:

Uninstalled VS Code, then .NET Core 2.1, deleted the VS Code extension folder from %USER%\.vscode\ , re-installed VS Code, then .NET Core 2.1, and then the C# extension (C# for Visual Studio Code (powered by OmniSharp)).

When the VS Code starts, it does download the "OmniSharp" package successfully, but still, no prompt to rebuild assets when I open a C# file. Debugging gives the same issue as before.

Here is the launch.json:

"version": "0.2.0",
"configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceFolder}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll",
        "args": [],
        "cwd": "${workspaceFolder}",
        "console": "internalConsole",
        "stopAtEntry": false,
        "internalConsoleOptions": "openOnSessionStart"
    }

And the tasks.json:

    "version": "2.0.0",
"tasks": [
    {
        "label": "build",
        "command": "dotnet build",
        "type": "shell",
        "group": "build",
        "presentation": {
            "reveal": "silent"
        },
        "problemMatcher": "$msCompile"
    }
]
}


Solution 1:[1]

I found a solution that worked for me. My VS Code was giving me the same error message, and what I did to fix it was:

- Press the combination Ctrl + Shift + P
- Restart Omnisharp
- Then it asks if you want to add missing files for build.
- Click Yes.

After this I was able to debug my app.

Hope it works for you!

Solution 2:[2]

Visit your \bin\Debug\netcoreapp3.1 in your project folder (That you open in VS)

Go to launch.json file in VS:

Replace: "program": "${workspaceFolder}/bin/Debug//.dll",

With: "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/CSharp.dll",

In may case, the project is called CSharp. Watch out.

Solution 3:[3]

I had a the same error. The debugger was looking for the .dll file in ${workspaceFolder}/bin/Debug/netcoreapp3.1/myApp.dll but the file was located in ${workspaceFolder}/bin/MCD/Debug/netcoreapp3.1/tradeAppl.dll

After changing the launch.json file to read

...
"program": "${workspaceFolder}/bin/MCD/Debug/netcoreapp3.1/tradeAppl.dll",
...

I was able to debug the application without any problems.

Solution 4:[4]

Since you have :".dll" taged with "<" and ">", it means that you have give it a value. The easiest way to do it is to open the project in VSCode and use find&replace to replace the: with your project name which I do believe its: "test" as per the .dll name

Solution 5:[5]

Configure your Launch.json like this Gist

And there is no need to Tasks.json , you can Press F5 to build or configure it your self to which command should be run in default shell when you press F5

Solution 6:[6]

// "program": "${workspaceFolder}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll",
   "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/csharp_multi_threads.dll",

You need to change the program value as it reminded

Solution 7:[7]

I switched to MS Visual Studio, since I did not find any other solutions.

Solution 8:[8]

-Right Click on Project Name And Click on Reveal in Explorer -Copy Url In Explorer After Folder Name For Example My Folder Address is D:\IOT\Projects\LWSIOT_WebApiWM2\LWSIOT_WebApiWM2\LWSIOT_WebApiWM2\bin\Debug\netcoreapp3.1\LWSIOT_WebApiWM2.dll And In Launch.json : ${workspaceFolder}/LWSIOT_WebApiWM2/LWSIOT_WebApiWM2/bin/Debug/netcoreapp3.1/LWSIOT_WebApiWM2.dll -Paste in Launch.json on "Program":"<Your_Address>" -Click On Debug And Its OK

Solution 9:[9]

In launch.json , replace :

"program": "${workspaceFolder}/Api/bin/Debug/netcoreapp3.1/Api.dll",

with:

"program": "${workspaceFolder}/Api/bin/linux/Debug/netcoreapp3.1/Api.dll"

Since I was running code in Linux machine so I should have provided Linux Folder' path

Solution 10:[10]

Must be an issue with the path to the dll in the program property of the launch.json file.

In my case, it still contained the old .net core framework version after the version upgrade.