Inside the AssemblyInfo.cs file there is this line: [assembly: AssemblyVersion("1.0.0.1")] , and I try to subtract the numbers in it, each of which is a variable in the following structure.
static struct Version { public static int Major, Minor, Build, Revision; }
I use this template to try to get numbers:
string VersionPattern = @"\[assembly\: AssemblyVersion\(""(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})""\)\]";
However, when I use this code, the result is not as expected, instead it shows the full line, as if it were a real match, and not every number in the group.
Match match = new Regex(VersionPattern).Match(this.mContents); if (match.Success) { bool success = int.TryParse(match.Groups[0].Value,Version.Major); ... }
In this case, this.mContents is all the text read from the file, and match.Groups[0].Value should be "1" from AssemblyVersion
My question is to get these numbers one by one using Regex.
This small tool consists in increasing the version of the application each time, when Visual Studio creates it, and I know that there are many tools for this.
jfevia
source share