-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running MSBuild based build task hangs forever #35752
Comments
I'm having the exact same issue with a C# project (trying to use msbuild task to generate an .exe with .NET 4.7 -- not using .NET Core). The build task just hangs forever (shows a spinning icon in the bottom-left statusbar) and killing VS Code is the only way to terminate it. I'm attaching the sample project here. |
I was able to reproduce this. It is independent of the .Net version. I haven't found out yet why this is broken right now (it used to work before), but an easy workaround is to change the type from process to shell. {
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"taskName": "build",
"type": "shell",
"command": "msbuild",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
"/t:build"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
} |
@Tyriar to execute a process in the terminal I basically uses it as the executable to be started. The command line for the msbuild process looks like this: For some reason that fails but I get no feedback why. All I see is that the node process started as {
"taskName": "node",
"type": "process",
"command": "node",
"args": [
"hello.js"
]
} it works fine. So this is not a principal issue. I guess somehow the command line for msbuild gets messed up. Is there a way I can debug this? |
@dbaemer thanks, setting type from process to shell definitely got past the hanging build task problem. Now it's on to the next issue for me:
I will look for a separate bug for that. Thanks! |
@Identifier is MSBuild on your |
@plbpietrz Nope, I purposefully haven't installed Visual Studio on this machine yet - I wanted to see how easy it was to create a simple console application (.exe, not .NET Core) with just VSCode on a clean machine. I was hoping that the version of MSBuild that comes with OmniSharp would have been sufficient but unfortunately it's not. Even if you add it to the path (or fully specify the full path in the "command" parameter in tasks.json) it fails for some other reason:
I finally got it to build on the clean machine by pointing to a version of MSBuild at C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe which must have been installed sometime else. But none of this would have been even possible without @dbaemer's suggestion of changing the type from process to shell. Thanks again @dbaeumer |
@Identifier good to hear that it works for you as a shell task. I will make this the default for msbuild since it makes more sense anyways. Keeping this open since we need to fix the underlying issue as well. |
changing from process to shell worked for me too. |
OK. #31301 got addressed. I will close this issue since it will now correctly result in an error if msbuild can't be found. |
VSCode gets stuck when trying to build a simple C++ project (Visual C++ template console app) using the default build task (generated by the editor) with the terminal showing that it tries to execute MSBuild. The editor indicates that the command is running but the process explorer shows only one new
code.exe
process instance spawned and one of the existing earliercode.exe
processes spinning excessively onCode.exe!IsSandboxedProcess
, nothing else. Now I can't run any more build tasks and cannot stop the 'executing' one. To reset the situation I have to restart the editor.Steps to Reproduce:
code .
(from visual studio developer prompt but no difference if normalcmd.exe
is used)tasks.json
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: