Function Get-BuildConfigs { <# .SYNOPSIS Get the build configs from a single csproj #> [CmdletBinding()] Param( $csprojPath ) process { if (!(Test-Path $csprojPath)) { Write-Warning "can't test on an empty path [$csprojPath]" return } $returnValues = @() $xml = [Xml](Get-Content $csprojPath) $propertyGroups = @($xml.Project.PropertyGroup) foreach($propertyGroup in $propertyGroups) { if ($null -ne $propertyGroup.Condition) { $value = $propertyGroup.Condition.Replace("'",'').Split('==')[-1].Split('|')[0].Trim() if (!([string]::IsNullOrWhiteSpace($value))) { $returnValues += $value } } } return $returnValues } }