I have a regular expression that I use (only in the test) to update AssemblyVersion from the AssemblyInfo.cs file. I am wondering, however, what is the best way to pull and replace this value from a .cs file would be?
Here is my best guess, which obviously doesn't work, but the general idea is in place. Hope for something more elegant.
Get-Content $file | Foreach-Object{ $var = $_ if($var -contains "AssemblyVersion"){ $temp = [regex]::match($s, '"([^"]+)"').Groups[1].Value.Substring(0, $prog.LastIndexOf(".")+1) + 1234 $var = $var.SubString(0, $var.FirstIndexOf('"') + $temp + $var.SubString($var.LastIndexOf('"'), $var.Length-1)) } }
EDIT
In the query, here is the line I want to update in AssemblyInfo:
[assembly: AssemblyVersion("1.0.0.0")]
powershell
NealR
source share