I need to search for a pattern in a file and change the value of the version. Here's the pattern :
[file: FileVersion("1.2.3.$VAR$")]
In my Powershell script, I have a variable with the Pattern inside :
$FileVersionPattern = '[file: FileVersion("[0-9]*.[0-9]*.[0-9]*.$VAR$")]'
(Get-Content "$filePath") -replace($FileVersionPattern, ('[file: FileVersion("' + $Major + '.' + $Minor + '.' + $Release + '.$VAR$")]')) | Set-Content "$filePath"
So the return should be ($Major = 5 $Minor = 5 $Release = 5)
:
[file: FileVersion("5.5.5.$VAR$")]
It seems that the $VAR$
and the parenthesis is causing my script to fail.