$ErrorActionPreference = 'Stop' $sourceRoot = Split-Path -Parent $PSScriptRoot $framework = Join-Path $env:WINDIR 'Microsoft.NET\Framework64\v4.0.30319' $buildDir = Join-Path $sourceRoot 'run\light-theme-preview' $outputDir = Join-Path $sourceRoot 'preview\light-variants' New-Item -ItemType Directory -Force -Path $buildDir | Out-Null $renderExe = Join-Path $buildDir 'RenderLightThemes.exe' $references = @('WPF\PresentationFramework.dll', 'WPF\PresentationCore.dll', 'WPF\WindowsBase.dll', 'System.Xaml.dll', 'System.dll', 'System.Core.dll', 'System.Windows.Forms.dll', 'System.Drawing.dll', 'System.Web.Extensions.dll') | ForEach-Object { '/reference:' + (Join-Path $framework $_) } $sources = @('Version.cs', 'SbLauncher.cs', 'ViewModels.cs', 'App.cs', 'Import.cs', 'tools\RenderLightThemes.cs') | ForEach-Object { Join-Path $sourceRoot $_ } & (Join-Path $framework 'csc.exe') /nologo /target:exe /platform:x64 /main:RenderLightThemes "/out:$renderExe" @references @sources if ($LASTEXITCODE -ne 0) { throw 'Preview compilation failed.' } & $renderExe $sourceRoot $outputDir if ($LASTEXITCODE -ne 0) { throw 'Preview rendering failed.' }