Initial version of the .NET HostAvailabilityMonitor.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user