MSBuild Running Slow Called from PowerShell Script (Visual Studio 2019) RRS feed

  • Question

  • Hi there folks,

    I set up a new TFS Build Server recently and I'm investigating some extended time periods during the build process.  One of those periods is the recompiling of our Selenium test .dll.  First, the packages are restored via MSBuild, which is fine.  Then, the script hangs for about 10 minutes, while the .dll is actually compiled.

    This worked fine on our Visual Studio 2017 Build Server, (took a few seconds to compile I believe) but seems problematic with 2019.

    Here's the code.  Am I missing an MSBuild parameter or two?

    $msbuild = """C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe"""
    # Rebuild the Test source .dll...
    Write-Host "********** Running UI Tests **********"
    # Restore Selenium packages...
    Write-Host "********** Restoring Selenium Packages **********"
    &"C:\Nuget.exe\Nuget.exe" restore  $source\Development\12.0\Web\MyAppWeb\MyCo.SeleniumUITest\MyCo.SeleniumUITest.sln -DisableParallelProcessing
    Write-Host "********** Selenium Packages Restored **********"
    # Changes for new MSBuild....
    $projfile = "$source\Development\12.0\Web\MyAppWeb\MyCo.SeleniumUITest\MyCo.SeleniumUITest.sln"
        start-process $msbuild -ArgumentList @($projfile,'/t:Rebuild','/p:configuration=Release') -Wait
        Write-Host "********** Selenium .dll compiled successfully! **********"
        Write-Host $_.Exception.Message
        exit 1

    Any Help Appreciated!  If this should go in the PowerShell forum, let me know.  I thought MSBuild would be the correct place as I'm hoping its just a parameter or call tweak.

    Friday, January 17, 2020 6:46 PM

All replies

  • Hi NitLions,

    Sorry for delay in reply.

    According to your description, you could redirect to TFS forum. Since tfs forum has been removed, we recommend you to move to stack overflow with tfs tag, where you could get better support for it.

    Thank you for understanding.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, January 20, 2020 2:44 AM