44 lines
1.2 KiB
PowerShell
44 lines
1.2 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Target,
|
|
|
|
[ValidateSet("Debug", "Release")]
|
|
[string]$Configuration = "Debug",
|
|
|
|
[ValidateSet("x64", "x86", "Win32")]
|
|
[string]$Platform = "x64"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$vswhere = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
|
|
if (-not (Test-Path $vswhere)) {
|
|
Write-Host "ERROR: vswhere.exe not found at $vswhere" -ForegroundColor Red
|
|
Write-Host "Install Visual Studio Installer (comes with VS 2017+)." -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
|
|
$msbuild = & $vswhere -latest -prerelease -products * `
|
|
-requires Microsoft.Component.MSBuild `
|
|
-find 'MSBuild\**\Bin\MSBuild.exe' | Select-Object -First 1
|
|
|
|
if (-not $msbuild) {
|
|
Write-Host "ERROR: MSBuild not found via vswhere" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
$sln = Join-Path $PSScriptRoot "..\YAMA.sln" | Resolve-Path
|
|
|
|
Write-Host "MSBuild : $msbuild" -ForegroundColor Cyan
|
|
Write-Host "Solution: $sln" -ForegroundColor Cyan
|
|
Write-Host "Target : $Target | $Configuration | $Platform" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
& $msbuild $sln.Path `
|
|
"/t:$Target" `
|
|
"/p:Configuration=$Configuration" `
|
|
"/p:Platform=$Platform" `
|
|
/m /v:minimal /nologo
|
|
|
|
exit $LASTEXITCODE
|