TFS Build using PowerShell x86 to run -
TFS Build using PowerShell x86 to run -
i have build definition setup phone call powershell script "extra stuff" such using custom version number , dll signing. problem i'm having in powershell script, trying load assembly can create object of type , error when seek loading assembly. found out assembly need load requires script run x86 process.
i found out when ran powershell script windows powershell x86 instead of regular windows powershell process. there way in build definition can state process can run as? such build process template or in script itself?
i did 1 time in past, see if still working.
# path powershell resides. if caller passes -use32 # create sure returning 32 bit version of powershell regardless # of current machine architecture function get-powershellpath() { param ( [switch]$use32=$false, [string]$version="1.0" ) if ( $use32 -and (test-win64machine) ) { homecoming (join-path $env:windir "syswow64\windowspowershell\v$version\powershell.exe") } homecoming (join-path $env:windir "system32\windowspowershell\v$version\powershell.exe") } # win64 machine regardless of whether or not # running in 64 bit mode function test-win64machine() { homecoming test-path (join-path $env:windir "syswow64") } # wow64 powershell host function test-wow64() { homecoming (test-win32) -and (test-path env:\processor_architew6432) } # 64 bit process function test-win64() { homecoming [intptr]::size -eq 8 } # 32 bit process function test-win32() { homecoming [intptr]::size -eq 4 } function get-programfiles32() { if (test-win64 ) { homecoming ${env:programfiles(x86)} } homecoming $env:programfiles } function exec-script32 { param( [string] $scriptpath ) $scriptname = split-path -leaf $scriptpath $innerlogfilename = join-path $env:temp $scriptname $innerlogfilename += ".log" $datafilename = join-path $env:temp $scriptname $datafilename += ".data" export-clixml -path $datafilename -inputobject $args $ps32 = get-powershellpath -use32 write-verbose "### re-entering '$scriptpath' in 32-bit shell" write-verbose "### logging '$innerlogfilename'" # phone call exact file & $ps32 -file $scriptpath $datafilename 2>&1 > $innerlogfilename $succeeded = $? write-output (get-content $innerlogfilename) remove-item $innerlogfilename if (!$succeeded) { #forward throw "$scriptpath failed" } }
powershell tfs tfsbuild
Comments
Post a Comment