I'm trying to learn how to create method libraries but whenever I run my program a little pop-up window (with a surprisingly basic Windows graphical interface, post-update) shows up with the message "PreLaunch task 'Build' terminated with exit code 1."
I click on "Show error" and in the "problems" tab I see the message "No problems in the workspace so far."
Does anyone know what's going on?
Here are my launch configurations...


Here is a screenshot of that pop-up window bearing the message.

Also, I'm not sure if this is related but I noticed that this stuff started happening after I moved the .NET SDK files to another folder, and also when the debugging shortcut command stopped working.
28 Answers
I encountered the same error after renaming my project. The problems was that in my task.json file, the arguments were referencing my previous project csproj file.
task.json (old)
{ "version": "2.0.0", "tasks": [ { "label": "build", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/MyOldProject.csproj" ], "problemMatcher": "$msCompile" } ] }`
I changed the csproj file name to the current project's name it worked without any errors.
0The problem might be in the tasks.json file since the error is "PreLaunch task 'Build'" (that's in the tasks.json file).
With the latest vscode update all the warnings in the console were treated as errors and since I removed this line of configuration "problemMatcher": "$msCompile" (in tasks.json) it solved the problem for me.
In mac ensure the VSCode can detect .NET
Try doing a symbolic link.
sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
Also, ensure that terminal.integrated.inheritEnv is true in VSCode settings.
In dotnet the Main() method needs to be a static. Try changing your definition from
public void main()
to
public static void Main()
and see if that helps. This microsoft doc will give you some more information
1There is a problem in your Launch.json, in your First Picture , in .Net Core Launch (web) section , in Program attribute, you should write the framework you are using and your project name instead of the default text.
for example netstandard2.0 and mylibrary.dll
And you can remove the web configuration if you are not going to write asp code.
Also you can delete Tasks.json because you can build and test your whole project by F5 by configuring your Launch.json like this Gist
Try to see any update is required or an extension is needed I searched for ms-dotnettools.csharp-1.21.13 and it worked ok.
It is my first time to use Visual Studio Code IDE to create a C# program, I just follow the simple guideline to test the first case "Hello world". unfortunately, I got the same issue, so I had traced every step to look at what's wrong with me, the result was I didn't close my "Dotnet run Environment"
All my steps:
Step 1:using command line to create "Dotnet environment"

Step 2:using VS Code IDE to open this folder "MyWebsite" and I got the error message after ran it

Step 3: closing "command line" and VS Code is okay now 
6/16/2023~
Hi, I got the same problem, reading online I found something related to the launch.js file. After just only removing a line it works:
"preLaunchTask": "build",
1