function Get-LastBuiltVersion { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$StateFilePath ) if (-not (Test-Path -LiteralPath $StateFilePath)) { return $null } $content = Get-Content -LiteralPath $StateFilePath -Raw -ErrorAction Stop if ([string]::IsNullOrWhiteSpace($content)) { return $null } return $content.Trim() }