dotnet / dotnet/msbuild

Msbuild 15.0 hangs when triggered from Powershell

Open
#2,269 17 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

I am trying to upgrade from MSBduil 4.0 to 15.0. The same set of solution files I build take about 9 minutes in total with msbuild 4.0 but take 10 minutes each when I run them with msbuild 15.0. The symptoms are always the same, the build itself (according to the logs) is done within seconds but the process from Start-Process msbuild.exe takes 10minutes to exit.

I tried several suggestions on the web; like using nr:false, /p:UseSharedCompilation=false but nothing worked all the way.

The strange thing is that I run the same msbuild.exe command in cmd and it doesn't reproduce this.

I should mention that when I build multiple solutions back to back, /p:UseSharedCompilation=false seems to work but I also have to use powershell to start cmd.exe which starts msbuild.exe.

If I used /p:UseSharedCompilation=false while building 1 solution only, it takes about double the time it would normally take.

In summary, what I want to do is:

Start-Process $msBuildPath $msBuildArguments
where $msBuildArguments are: /p:Configuration=Debug /m /p:BuildInParallel=true /nr:False "/p:WarningLevel=4" /p:Platform="Any CPU" /target:Rebuild /nologo /v:q /fileLogger "/fileLoggerParameters:LogFile=C:\temp\BuildLogs\.msbuild.log;verbosity=normal;ShowTimeStamp"

After a week or so of trying different things, I wanted to ask you for suggestions about what I can do to avoid this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported invocation with PowerShell's Start-Process and the supplied msbuild.exe arguments, then compare it with the same command launched through cmd.exe. The payload names no source file or test; done would mean identifying why the PowerShell-launched process remains alive and documenting or validating a fix without the reported delay.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.