$formsType = 'System.Windows.Forms.Form' -as [type] if ($null -eq $formsType) { Add-Type -AssemblyName System.Windows.Forms } $drawingType = 'System.Drawing.Color' -as [type] if ($null -eq $drawingType) { Add-Type -AssemblyName System.Drawing } if ([System.Threading.Thread]::CurrentThread.GetApartmentState() -ne [System.Threading.ApartmentState]::STA) { $powershell = (Get-Command powershell.exe -ErrorAction SilentlyContinue).Source if ($powershell) { & $powershell -NoProfile -ExecutionPolicy Bypass -STA -File $PSCommandPath @args exit $LASTEXITCODE } } $coreScript = Join-Path -Path $PSScriptRoot -ChildPath 'Compiler.Core.ps1' & $coreScript @args