使用Regular Expression更改AssemblyInfo.vb中的AssemblyVersion

时间:2009-05-01 12:41:21

标签: regex vb.net

我正在尝试从AssemblyInfo.vb文件中获取版本号,并将其替换为我选择的数字。

Dim text as string = string.empty
Using sr As New StreamReader("C:\foo\AssemblyInfo.vb")
    text = sr.ReadToEnd()
    Dim fileVerReg As New Regex("^[^']*(AssemblyVersion[(""].)([^""]*)")
    Dim m As Match = fileVerReg.Match(text)
    If m.Success Then
         MsgBox(m.Groups(2).Value)
    End If
 End Using

这只是让我尝试获取版本,理想情况下我需要进行替换。

1 个答案:

答案 0 :(得分:0)

尝试使用以下VS插件Versioning Controlled Build,比正则表达式更好。我在我的开发机器和我的构建机器上使用它(目前都是VS 2008,但之前在VS 2005上使用过它)。