title: Get and Replace AssemblyVersion from AssemblyInfo.cs
body: <p>I have a regex I'm using (in test only) to update the <code>AssemblyVersion</code> from the <code>AssemblyInfo.cs</code> file. I'm wondering, however, what the best way to pull and replace this value from the <code>.cs</code> file itself would be? </p>
  
  <p>Here is my best guess which, obviously, isn't working but the general idea is in place. Was hoping for something a little more elegant. </p>
  
  <pre><code>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))
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Per request here is the line I'm looking to update in the AssemblyInfo: </p>
  
  <pre><code>[assembly: AssemblyVersion("1.0.0.0")] 
  </code></pre>