Updated to .NET Framework 4.7.2 due to platform limitations, added email cc, bcc and some fixes.

This commit is contained in:
2026-04-21 11:46:55 +02:00
parent c267069d02
commit b8b702bda3
40 changed files with 5666 additions and 2064 deletions
+60 -47
View File
@@ -1,47 +1,60 @@
param(
[string]$Configuration = "Release"
)
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = Split-Path -Parent $scriptDir
$solutionPath = Join-Path $repoRoot "HostAvailabilityMonitor.sln"
function Get-MSBuildPath {
$msbuildFromPath = Get-Command msbuild.exe -ErrorAction SilentlyContinue
if ($msbuildFromPath) {
return $msbuildFromPath.Source
}
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhere) {
$installationPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
if ($installationPath) {
$candidate = Join-Path $installationPath "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $candidate) {
return $candidate
}
}
}
throw "MSBuild.exe wurde nicht gefunden. Bitte Visual Studio Build Tools oder Visual Studio installieren."
}
$msbuild = Get-MSBuildPath
Write-Host "Verwende MSBuild: $msbuild"
& $msbuild $solutionPath /t:Build /p:Configuration=$Configuration /p:Platform="Any CPU"
$projectDir = Join-Path $repoRoot "src\HostAvailabilityMonitor"
$outputDir = Join-Path $projectDir "bin\$Configuration"
$publishDir = Join-Path $repoRoot "artifacts\publish\net48"
if (Test-Path $publishDir) {
Remove-Item -Path $publishDir -Recurse -Force
}
New-Item -ItemType Directory -Path $publishDir | Out-Null
Copy-Item -Path (Join-Path $outputDir "*") -Destination $publishDir -Recurse -Force
Write-Host "Build abgeschlossen. Publish-Verzeichnis: $publishDir"
param(
[string]$Configuration = "Release",
[switch]$CreateDeploymentPackage
)
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = Split-Path -Parent $scriptDir
$solutionPath = Join-Path $repoRoot "HostAvailabilityMonitor.sln"
function Get-MSBuildPath {
$msbuildFromPath = Get-Command msbuild.exe -ErrorAction SilentlyContinue
if ($msbuildFromPath) {
return $msbuildFromPath.Source
}
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhere) {
$installationPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
if ($installationPath) {
$candidate = Join-Path $installationPath "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $candidate) {
return $candidate
}
}
}
throw "MSBuild.exe wurde nicht gefunden. Bitte Visual Studio Build Tools oder Visual Studio installieren."
}
$msbuild = Get-MSBuildPath
Write-Host "Verwende MSBuild: $msbuild"
& $msbuild $solutionPath /t:Build /p:Configuration=$Configuration /p:Platform="Any CPU"
$publishRoot = Join-Path $repoRoot "artifacts\publish\net472"
if (Test-Path $publishRoot) {
Remove-Item -Path $publishRoot -Recurse -Force
}
New-Item -ItemType Directory -Path $publishRoot | Out-Null
$projects = @(
@{ Name = "HostAvailabilityMonitor"; ProjectDir = Join-Path $repoRoot "src\HostAvailabilityMonitor" },
@{ Name = "BizTalkMonitorConfigGenerator"; ProjectDir = Join-Path $repoRoot "src\BizTalkMonitorConfigGenerator" }
)
foreach ($project in $projects) {
$outputDir = Join-Path $project.ProjectDir "bin\$Configuration"
$targetDir = Join-Path $publishRoot $project.Name
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
Copy-Item -Path (Join-Path $outputDir "*") -Destination $targetDir -Recurse -Force
Write-Host "Publish-Verzeichnis für $($project.Name): $targetDir"
}
Write-Host "Build abgeschlossen. Publish-Root: $publishRoot"
if ($CreateDeploymentPackage) {
& (Join-Path $scriptDir 'package-deployment.ps1') -PublishRoot '.\artifacts\publish\net472'
}
+25
View File
@@ -0,0 +1,25 @@
param(
[string]$InstallPath = 'C:\Tools\BizTalkMonitorConfigGenerator',
[string]$ConfigPath
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (-not $ConfigPath) {
$ConfigPath = Join-Path $InstallPath 'generator-settings.json'
}
$exePath = Join-Path $InstallPath 'BizTalkMonitorConfigGenerator.exe'
if (-not (Test-Path -LiteralPath $exePath)) {
throw "Executable wurde nicht gefunden: $exePath"
}
if (-not (Test-Path -LiteralPath $ConfigPath)) {
throw "Konfigurationsdatei wurde nicht gefunden: $ConfigPath"
}
& $exePath $ConfigPath
$exitCode = $LASTEXITCODE
Write-Host "ExitCode: $exitCode"
exit $exitCode
+58
View File
@@ -0,0 +1,58 @@
param(
[Parameter(Mandatory = $true)]
[string]$SourcePath,
[Parameter(Mandatory = $true)]
[string]$InstallPath,
[string]$EventSource = "BizTalkMonitorConfigGenerator",
[string]$EventLogName = "Application",
[switch]$RegisterEventSource,
[switch]$CreateBackup
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Write-Info {
param([string]$Message)
Write-Host "[INFO] $Message"
}
if (-not (Test-Path -LiteralPath $SourcePath)) {
throw "SourcePath '$SourcePath' existiert nicht."
}
$sourceFullPath = (Resolve-Path -LiteralPath $SourcePath).Path
$installFullPath = [System.IO.Path]::GetFullPath($InstallPath)
Write-Info "Quelldateien: $sourceFullPath"
Write-Info "Zielverzeichnis: $installFullPath"
if (Test-Path -LiteralPath $installFullPath) {
if ($CreateBackup) {
$backupRoot = Join-Path -Path ([System.IO.Path]::GetDirectoryName($installFullPath)) -ChildPath ((Split-Path -Path $installFullPath -Leaf) + '_backup_' + (Get-Date -Format 'yyyyMMdd_HHmmss'))
Write-Info "Erstelle Backup unter $backupRoot"
Copy-Item -Path (Join-Path $installFullPath '*') -Destination $backupRoot -Recurse -Force -ErrorAction SilentlyContinue
}
}
else {
New-Item -Path $installFullPath -ItemType Directory | Out-Null
}
Write-Info "Kopiere Dateien..."
Copy-Item -Path (Join-Path $sourceFullPath '*') -Destination $installFullPath -Recurse -Force
New-Item -Path (Join-Path $installFullPath 'logs') -ItemType Directory -Force | Out-Null
if ($RegisterEventSource) {
$registerScript = Join-Path -Path $PSScriptRoot -ChildPath 'register-event-source.ps1'
if (-not (Test-Path -LiteralPath $registerScript)) {
throw "register-event-source.ps1 wurde nicht gefunden: $registerScript"
}
Write-Info "Registriere Event Source '$EventSource' im Log '$EventLogName'"
& $registerScript -Source $EventSource -LogName $EventLogName
}
Write-Info 'Installation des BizTalkMonitorConfigGenerator abgeschlossen.'
Write-Info 'Prüfen Sie nun generator-settings.json und führen Sie einen Testlauf aus.'
+60
View File
@@ -0,0 +1,60 @@
param(
[Parameter(Mandatory = $true)]
[string]$SourcePath,
[Parameter(Mandatory = $true)]
[string]$InstallPath,
[string]$EventSource = "HostAvailabilityMonitor",
[string]$EventLogName = "Application",
[switch]$RegisterEventSource,
[switch]$CreateBackup
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Write-Info {
param([string]$Message)
Write-Host "[INFO] $Message"
}
if (-not (Test-Path -LiteralPath $SourcePath)) {
throw "SourcePath '$SourcePath' existiert nicht."
}
$sourceFullPath = (Resolve-Path -LiteralPath $SourcePath).Path
$installFullPath = [System.IO.Path]::GetFullPath($InstallPath)
Write-Info "Quelldateien: $sourceFullPath"
Write-Info "Zielverzeichnis: $installFullPath"
if (Test-Path -LiteralPath $installFullPath) {
if ($CreateBackup) {
$backupRoot = Join-Path -Path ([System.IO.Path]::GetDirectoryName($installFullPath)) -ChildPath ((Split-Path -Path $installFullPath -Leaf) + '_backup_' + (Get-Date -Format 'yyyyMMdd_HHmmss'))
Write-Info "Erstelle Backup unter $backupRoot"
Copy-Item -Path (Join-Path $installFullPath '*') -Destination $backupRoot -Recurse -Force -ErrorAction SilentlyContinue
}
}
else {
New-Item -Path $installFullPath -ItemType Directory | Out-Null
}
Write-Info "Kopiere Dateien..."
Copy-Item -Path (Join-Path $sourceFullPath '*') -Destination $installFullPath -Recurse -Force
New-Item -Path (Join-Path $installFullPath 'logs') -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $installFullPath 'state') -ItemType Directory -Force | Out-Null
if ($RegisterEventSource) {
$registerScript = Join-Path -Path $PSScriptRoot -ChildPath 'register-event-source.ps1'
if (-not (Test-Path -LiteralPath $registerScript)) {
throw "register-event-source.ps1 wurde nicht gefunden: $registerScript"
}
Write-Info "Registriere Event Source '$EventSource' im Log '$EventLogName'"
& $registerScript -Source $EventSource -LogName $EventLogName
}
Write-Info 'Installation abgeschlossen.'
Write-Info "Prüfen Sie nun appsettings.json, Task Scheduler und Servicekonto-Berechtigungen."
+73
View File
@@ -0,0 +1,73 @@
param(
[string]$PublishRoot = ".\artifacts\publish\net472",
[string]$OutputRoot = ".\artifacts\deploy\net472",
[string]$PackageName = "biztalk-endpoint-monitor-net472-deployment"
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Ensure-Path {
param([string]$Path)
if (-not (Test-Path -LiteralPath $Path)) {
throw "Pfad nicht gefunden: $Path"
}
}
$repoRoot = Split-Path -Parent $PSScriptRoot
$publishRootFull = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $PublishRoot))
$outputRootFull = [System.IO.Path]::GetFullPath((Join-Path $repoRoot $OutputRoot))
$stagingRoot = Join-Path $outputRootFull $PackageName
$zipPath = Join-Path $outputRootFull ($PackageName + '.zip')
Ensure-Path -Path $publishRootFull
Ensure-Path -Path (Join-Path $publishRootFull 'HostAvailabilityMonitor')
Ensure-Path -Path (Join-Path $publishRootFull 'BizTalkMonitorConfigGenerator')
if (Test-Path -LiteralPath $stagingRoot) {
Remove-Item -LiteralPath $stagingRoot -Recurse -Force
}
if (Test-Path -LiteralPath $zipPath) {
Remove-Item -LiteralPath $zipPath -Force
}
New-Item -Path $stagingRoot -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $stagingRoot 'monitor') -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $stagingRoot 'generator') -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $stagingRoot 'scripts') -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $stagingRoot 'installers') -ItemType Directory -Force | Out-Null
New-Item -Path (Join-Path $stagingRoot 'docs') -ItemType Directory -Force | Out-Null
Copy-Item -Path (Join-Path $publishRootFull 'HostAvailabilityMonitor\*') -Destination (Join-Path $stagingRoot 'monitor') -Recurse -Force
Copy-Item -Path (Join-Path $publishRootFull 'BizTalkMonitorConfigGenerator\*') -Destination (Join-Path $stagingRoot 'generator') -Recurse -Force
Copy-Item -Path (Join-Path $repoRoot 'scripts\*') -Destination (Join-Path $stagingRoot 'scripts') -Recurse -Force
Copy-Item -Path (Join-Path $repoRoot 'installers\*') -Destination (Join-Path $stagingRoot 'installers') -Recurse -Force
Copy-Item -Path (Join-Path $repoRoot 'README.md') -Destination (Join-Path $stagingRoot 'docs\README.md') -Force
Copy-Item -Path (Join-Path $repoRoot 'Dokumentation.md') -Destination (Join-Path $stagingRoot 'docs\Dokumentation.md') -Force
Copy-Item -Path (Join-Path $repoRoot 'Documentation.en.md') -Destination (Join-Path $stagingRoot 'docs\Documentation.en.md') -Force
$deployNotes = @"
Deployment package: $PackageName
Created: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
Typical installation order:
1. Install generator
2. Adjust generator-settings.json
3. Generate monitor JSON
4. Install monitor
5. Configure Task Scheduler
PowerShell installers:
- installers\powershell\Install-HostAvailabilityMonitor.ps1
- installers\powershell\Install-BizTalkMonitorConfigGenerator.ps1
- installers\powershell\Install-Both.ps1
Optional MSI sources:
- installers\wix\HostAvailabilityMonitor.wxs
- installers\wix\BizTalkMonitorConfigGenerator.wxs
- installers\wix\build-msi.ps1
"@
$deployNotes | Set-Content -Path (Join-Path $stagingRoot 'deploy-notes.txt') -Encoding UTF8
Compress-Archive -Path (Join-Path $stagingRoot '*') -DestinationPath $zipPath -CompressionLevel Optimal
Write-Host "Deployment package created: $zipPath"