internal/FindOrReplaceAttributes.ps1
function FindOrReplaceAttribute { [CmdletBinding()] param( $text, $assemblyValue, $newValue ) begin { $regex = "\[assembly: Assembly" + $assemblyValue + "\((.+)\)\]" $replacement = '[assembly: Assembly' + $assemblyValue + '("' + $newValue + '")]' } process { $propertyExists = [regex]::matches($text, $regex) Write-Host " assembly property being applied $replacement" if ($propertyExists.Count -eq 1) { return $text -replace $regex, $replacement } return $text + $replacement } end {} } |