I would like to run an after build script with Powershell. This script needs to be run in 64bits. However, whenever I run msbuild with my .csproj file the script always runs in 32 bits. If I run the same script from the same powershell session where I started the msbuild, the script runs in x64 just fine.
My command:
msbuild .\src\Project.csproj /t:Build /p:Platform='x64' /p:Configuration='Debug'
I thought I could force to use the 64bits version like suggested on this post My target in my .csproj file:
<PropertyGroup>
<PowerShellExe>$(WINDIR)\system32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
</PropertyGroup>
<Target Name="AfterBuild">
<Exec Command="$(PowerShellExe) .\Run-AfterBuild.ps1" WorkingDirectory="$(OutputPath)"/>
</Target>
The beginning of the after build script:
Write-Host $"Is a 64bitsProcess $([System.Environment]::Is64BitProcess)"
When run from msbuild the output is false, and from the session session that launched msbuild but running the script directly outputs true.
MS build version: 16.3