5

OK. I am in .NET Core and using Visual Studio Code on a Mac machine. Now, whenever I run my C# project then Visual Studio Code shows this annoying message:

The preLaunch task 'build' terminated with exit code 1

It shows me the option to click on a button called "Show problems". When I click on this button, it only shows the warning messages.

Now, if it was errors then it's OK to see this message. But the fact that it shows this message every time there are warnings (which to me is OK). That is very annoying. Is there a way I can configure Visual Studio Code to not show these messages on things like warnings?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Lost
  • 12,007
  • 32
  • 121
  • 193
  • did you check https://stackoverflow.com/questions/48590601/prelaunch-task-build-terminated-with-exit-code-1? – Dipen Shah Sep 20 '18 at 20:40

2 Answers2

5

In order to disable warnings, you should add -nowarn to args in the tasks.json file:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/MyProject.csproj",
                "-nowarn" // here
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
amirali
  • 1,888
  • 1
  • 11
  • 32
  • But as I mentioned in my question above, there are only warnings that I can see in terminal. What I am saying is that if there is anyway to configure VS Code that it does not show this message for trivial reasons like warnings? – Lost Sep 21 '18 at 16:29
  • @WorkBee So your topic should be : How to cinfigure _dotnet_ not to show warnings when compiling, Because vscode just runs the code in task.json. – amirali Sep 21 '18 at 18:56
3

It might be a problem with your task.json file. Check the arguments of the file and make sure the build is pointing at the right location:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/MyProject.csproj"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Barr J
  • 10,636
  • 1
  • 28
  • 46