|
- [CmdletBinding()]
- param(
- [string]$ProjectRoot = (Split-Path -Parent $PSScriptRoot)
- )
-
- $components = @(
- (Join-Path $ProjectRoot 'Controllers\HomeController.wsc'),
- (Join-Path $ProjectRoot 'Framework\Application.wsc')
- )
-
- foreach ($path in $components) {
- if (-not (Test-Path $path)) {
- Write-Warning "Component not found, skipping: $path"
- continue
- }
- Write-Output "Unregistering $path"
- $proc = Start-Process -FilePath 'regsvr32.exe' -ArgumentList "/s /u `"$path`"" -PassThru -Wait -WindowStyle Hidden
- if ($proc.ExitCode -ne 0) {
- throw "regsvr32 /u failed for $path (exit $($proc.ExitCode))"
- }
- }
-
- Write-Output "All WSC-MVC components unregistered."
|