param([Parameter(Mandatory)][ValidatePattern('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$')][string]$Version)
$ErrorActionPreference = 'Stop'
$path = Join-Path (Split-Path $PSScriptRoot) 'Directory.Build.props'
$content = Get-Content -LiteralPath $path -Raw
if ([regex]::Matches($content, '[^<]+').Count -ne 1) { throw 'Expected one Version in Directory.Build.props.' }
$content = [regex]::Replace($content, '[^<]+', "$Version")
[IO.File]::WriteAllText($path, $content)
Write-Output "AstroFrame version set to $Version. Commit and push the source, then push tag v$Version to build and publish automatically."