Exec powershell.exe hangs msbuild
Not sure you're going to like the answer.After a bit of play, it seems to be about the expansion of the property group. You put a new line in the value of PowerShellExe. This works fine:
<PropertyGroup> <PowerShellExe Condition=" '$(PowerShellExe)'=='' ">$(WINDIR)\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe> </PropertyGroup> <Target Name="AfterBuild"> <Exec Command="$(PowerShellExe) -NonInteractive -executionpolicy bypass -command "&{get-childitem}"" /> </Target>
Try:
<Exec Command='$(PowerShellExe) -NonInteractive -executionpolicy Unrestricted -command "& {Get-ChildItem}"' />