-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
40 lines (33 loc) · 1.59 KB
/
Copy pathbuild.ps1
File metadata and controls
40 lines (33 loc) · 1.59 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
38
39
40
# LMU Energy Plugin - Build Script
# Builds the plugin for SimHub
$ErrorActionPreference = "Stop"
$projectPath = "LMU REST API\LMU REST API.csproj"
$buildConfig = "Release"
$outputPath = "LMU REST API\bin\Release\LMU REST API.dll"
$simhubInstallDir = "C:\Program Files (x86)\SimHub"
Write-Host "Building LMU Energy Plugin..." -ForegroundColor Cyan
msbuild $projectPath /p:Configuration=$buildConfig /t:Build /v:minimal /nologo
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
Write-Host "`nBuild successful!" -ForegroundColor Green
Write-Host "Output: $outputPath" -ForegroundColor Gray
Write-Host "`nTo deploy to SimHub:" -ForegroundColor Yellow
Write-Host " Copy from: $outputPath" -ForegroundColor White
Write-Host " Copy to: $simhubInstallDir\LMU REST API.dll" -ForegroundColor White
Write-Host "`nNote: You may need administrator rights to copy to Program Files." -ForegroundColor Gray
Write-Host "Then restart SimHub to load the plugin." -ForegroundColor Gray
# Optional: Attempt to copy (will ask for elevation if needed)
$response = Read-Host "`nAttempt to copy now? (Y/N)"
if ($response -eq 'Y' -or $response -eq 'y') {
try {
Copy-Item -Path $outputPath -Destination "$simhubInstallDir\LMU REST API.dll" -Force
Write-Host "`nDeployed successfully!" -ForegroundColor Green
Write-Host "Restart SimHub to load the updated plugin." -ForegroundColor Yellow
}
catch {
Write-Host "`nFailed to copy: $_" -ForegroundColor Red
Write-Host "Please copy manually with administrator rights." -ForegroundColor Yellow
}
}