-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeploy.ps1
More file actions
37 lines (30 loc) · 1.22 KB
/
Deploy.ps1
File metadata and controls
37 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ProcessDrive Deploy Script
# Usage: Run as Administrator
# powershell -ExecutionPolicy Bypass -File Deploy.ps1
$ErrorActionPreference = 'Stop'
$ModuleName = 'ProcessDrive'
$TargetDir = Join-Path $env:ProgramFiles 'PowerShell\7\Modules' $ModuleName
$ProjectDir = $PSScriptRoot
# Build
Write-Host "Building $ModuleName..." -ForegroundColor Cyan
dotnet build "$ProjectDir\$ModuleName.csproj" -c Release --nologo -v q
if ($LASTEXITCODE -ne 0) { throw 'Build failed' }
$BinDir = Join-Path $ProjectDir 'bin\Release\net8.0-windows'
# Create module directory
if (!(Test-Path $TargetDir)) { New-Item $TargetDir -ItemType Directory -Force | Out-Null }
# Copy files
$ModuleDir = Join-Path $ProjectDir 'module'
Copy-Item "$BinDir\$ModuleName.dll" $TargetDir -Force
Copy-Item "$ModuleDir\$ModuleName.psd1" $TargetDir -Force
Copy-Item "$ModuleDir\$ModuleName.format.ps1xml" $TargetDir -Force
foreach ($locale in 'en-US', 'ja-JP') {
$src = Join-Path $ModuleDir $locale
if (Test-Path $src) { Copy-Item $src $TargetDir -Recurse -Force }
}
Write-Host ''
Write-Host "Deployed to: $TargetDir" -ForegroundColor Green
Write-Host ''
Write-Host 'Usage:' -ForegroundColor Yellow
Write-Host ' New-ProcDrive'
Write-Host ' cd Proc:\'
Write-Host ' dir'