JetBrains / teamcity-msbuild-logger

MSBuild logger for TeamCity
Apache License 2.0
19 stars 9 forks source link

WiX project builds hanging #8

Open dino182 opened 3 years ago

dino182 commented 3 years ago

I've encountered an issue with this library since upgrading to TeamCity 2020.1.4 from 2020.1.3.

The .NET build runner now calls C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe where it previously called C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe i.e. it used to call the 64-bit version but is now calling the 32-bit version.

This works for the vast majority of MSBuild tasks, but the build now hangs when it attempts to run the WiX tasks e.g. Candle and Light.

From studying Process Monitor I can see that the candle.exe application is never started and MSBuild is seemingly stuck waiting for it to launch and complete. All I can do is kill the MSBuild process from Task Manager.

I am able to reproduce this problem from the command line with this very simple example WiX project. I have the following software installed:

The command to run the build successfully is:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe" SetupProject1.sln /t:SetupProject1:Rebuild /p:Configuration=Release /l:TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,"C:\Program Files\TeamCity\buildAgent\plugins\dotnet\tools\msbuild15\TeamCity.MSBuild.Logger.dll";TeamCity;plain

The command that causes the hanging behaviour is:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" SetupProject1.sln /t:SetupProject1:Rebuild /p:Configuration=Release /l:TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,"C:\Program Files\TeamCity\buildAgent\plugins\dotnet\tools\msbuild15\TeamCity.MSBuild.Logger.dll";TeamCity;plain

I've tested this out with multiple versions of TeamCity.MSBuild.Logger going back to version 1.0.1 and this behaviour occurs in all versions.

Note that if I remove the TeamCity.MSBuild.Logger parameter from the command line, the build succeeds i.e. the following works

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" SetupProject1.sln /t:SetupProject1:Rebuild /p:Configuration=Release

so something in the TeamCity.MSBuild.Logger assembly is causing this behaviour.

Can you please fix this so that it works with the 32-bit MSBuild process?

cholt0425 commented 3 years ago

I am also having this issue. Does anyone know of any workaround for it?

dino182 commented 3 years ago

The workaround I'm using is to switch back to the MSBuild runner. TeamCity warns you that:

The MSBuild runner is no longer actively supported. It is recommended to use the .NET runner with the 'msbuild' command instead.

but this at least runs without hanging.

NikolayPianikov commented 3 years ago

@dino182 @cholt0425 Please make sure you have TeamCity 2020.2.4 installed and add the configuration parameter teamcity.internal.dotnet.default.bitness=X64.

dino182 commented 3 years ago

Thanks @NikolayPianikov. I have added this parameter to my build configuration. I can see that TeamCity has used the 64-bit MSBuild and has successfully completed the WiX build steps.

suntsu42 commented 3 years ago

I do have the same problem (Using version 2020.2.4) But even with this configuration parameter, msbuilt is started x86 Any idea whats wrong? image

Edit: After some time it started using the x64 version of msbuild and now it works