|
- [CmdletBinding()]
- param(
- [string]$ProjectRoot
- )
-
- if (-not $ProjectRoot) {
- $ProjectRoot = Split-Path -Parent $PSScriptRoot
- }
-
- $components = @(
- # Framework/ is the only thing genuinely shared between the production
- # and test-app sites. Controllers/ is production's own; SelfTestController
- # is test-app-specific and lives under test-app/ instead. See
- # docs/ARCHITECTURE.md.
- (Join-Path $ProjectRoot 'Framework\RequestContext.wsc'),
- (Join-Path $ProjectRoot 'Framework\Router.wsc'),
- (Join-Path $ProjectRoot 'Framework\Application.wsc'),
- (Join-Path $ProjectRoot 'Controllers\HomeController.wsc'),
- (Join-Path $ProjectRoot 'test-app\Controllers\SelfTestController.wsc')
- )
-
- foreach ($path in $components) {
- if (-not (Test-Path $path)) {
- throw "Component not found: $path"
- }
- Write-Output "Registering $path"
- $proc = Start-Process -FilePath 'regsvr32.exe' -ArgumentList "/s `"$path`"" -PassThru -Wait -WindowStyle Hidden
- if ($proc.ExitCode -ne 0) {
- throw "regsvr32 failed for $path (exit $($proc.ExitCode))"
- }
- }
-
- Write-Output "All WSC-MVC components registered."
|