This commit is contained in:
Mohaimen Hasan 2026-11-15 15:03:39 +06:00
parent ad8031c3a4
commit 5498b79851
3 changed files with 41 additions and 5 deletions

View File

@ -1,4 +1,4 @@
{
"version": "20261108-01",
"buildTime": "2026-11-08T05:31:24.9714459Z"
"version": "20261115-03",
"buildTime": "2026-11-15T08:30:42.0805569Z"
}

View File

@ -52,8 +52,8 @@
//"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
//"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development
"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development
"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBUATBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;",
"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBUATBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development
},
"Calendar": {

View File

@ -11,7 +11,7 @@
# Update these values for each client/environment before running
$baseHref = "/CELHRM_Master/"
$outputFolder = "publish\CELHRM_Master" # relative to this script's folder (repo root)
$outputFolder = "publish\CELHRM_Master" # relative to this script's folder (repo root); the version is added: CELHRM_Master_<version>
# These never change
$repoRoot = $PSScriptRoot
@ -48,6 +48,10 @@ $newCounter = $lastCounter + 1
$version = "$today-" + $newCounter.ToString("D2") # D2 = always 2 digits (01, 02, 03...)
$buildTime = (Get-Date).ToUniversalTime().ToString("o")
# Output folder carries the version: e.g. publish\CELHRM_Master_20260517-01
$destinationPath = Join-Path $repoRoot ($outputFolder + "_" + $version)
$wwwrootPath = Join-Path $destinationPath "wwwroot"
Write-Host ""
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " CEL HRM - Full Build & Deploy Script" -ForegroundColor Cyan
@ -132,6 +136,26 @@ Copy-Item -Path $distPath -Destination $wwwrootPath -Recurse -Force
Write-Host "[OK] Angular files copied to: $wwwrootPath" -ForegroundColor Green
# ---- STEP 5b: Copy everything in HRM.UI\RDLC into the published RDLC folder ---- #
# dotnet publish only copies the RDLC files the csproj lists, so a report (or an
# image it uses) can be missing on the server. Copy the whole folder as it is in
# the repo, overwriting what publish already put there.
$rdlcSourcePath = Join-Path $repoRoot "HRM.UI\RDLC"
$rdlcDestinationPath = Join-Path $destinationPath "RDLC"
if (Test-Path $rdlcSourcePath) {
if (-not (Test-Path $rdlcDestinationPath)) {
New-Item -ItemType Directory -Path $rdlcDestinationPath -Force | Out-Null
}
Copy-Item -Path (Join-Path $rdlcSourcePath "*") -Destination $rdlcDestinationPath -Recurse -Force
$rdlcCount = (Get-ChildItem -Path $rdlcDestinationPath -Recurse -File).Count
Write-Host "[OK] RDLC folder copied to: $rdlcDestinationPath ($rdlcCount files)" -ForegroundColor Green
} else {
Write-Host "[WARN] RDLC folder not found: $rdlcSourcePath (skipped)" -ForegroundColor Yellow
}
# ---- STEP 6: Write Angular web.config to wwwroot ---- #
# This is separate from the backend web.config that dotnet publish
# already generated at the root of $destinationPath (for the IIS
@ -200,6 +224,18 @@ $angularWebConfig | Out-File -FilePath "$wwwrootPath\web.config" -Encoding utf8
Write-Host "[OK] Angular web.config written to: $wwwrootPath\web.config" -ForegroundColor Green
# ---- STEP 7: Remove the backend web.config from the version folder ---- #
# The server keeps its own web.config (hosting settings per client), so the one
# dotnet publish generated at the folder root must not overwrite it on deploy.
# Only the root file is removed; wwwroot\web.config (Angular, STEP 6) stays.
$rootWebConfig = Join-Path $destinationPath "web.config"
if (Test-Path $rootWebConfig) {
Remove-Item -Path $rootWebConfig -Force
Write-Host "[OK] Removed web.config from: $destinationPath" -ForegroundColor Green
}
# ---- DONE ---- #
Write-Host ""
Write-Host "============================================" -ForegroundColor Cyan