# GenServer 编译 (NX 按需生成服务 A 版, 独立控制台 exe, 零 WPF 依赖) # 只编: src\GenServer\GenServer.cs + CatalogCore 的 Model/Configurator/ParametricEngine (共享规则引擎, 双端一致性红线) param([string]$Out = (Join-Path $PSScriptRoot '..\bin\GenServer.exe')) $fw = 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319' $csc = 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\Roslyn\csc.exe' if (-not (Test-Path $csc)) { Write-Output '未找到 csc.exe (VS Build Tools)'; exit 1 } $refs = @( (Join-Path $fw 'mscorlib.dll'), (Join-Path $fw 'System.dll'), (Join-Path $fw 'System.Core.dll'), (Join-Path $fw 'System.IO.Compression.dll'), (Join-Path $fw 'System.IO.Compression.FileSystem.dll'), (Join-Path $fw 'System.Web.Extensions.dll') ) $srcs = @( (Join-Path $PSScriptRoot '..\src\GenServer\GenServer.cs'), (Join-Path $PSScriptRoot '..\src\CatalogCore\Model.cs'), (Join-Path $PSScriptRoot '..\src\CatalogCore\Configurator.cs'), (Join-Path $PSScriptRoot '..\src\CatalogCore\ParametricEngine.cs') ) $outDir = Split-Path $Out New-Item -ItemType Directory -Force -Path $outDir | Out-Null $cscArgs = @('/nologo', '/target:exe', '/platform:anycpu', '/optimize+', '/utf8output', ('/out:' + $Out)) foreach ($r in $refs) { if (Test-Path $r) { $cscArgs += ('/reference:' + $r) } } $cscArgs += $srcs & $csc @cscArgs if ($LASTEXITCODE -eq 0) { Write-Output ("GenServer 编译成功: " + $Out) } else { Write-Output ("GenServer 编译失败 (exit " + $LASTEXITCODE + ")"); exit 1 }