From ec2a678daf85d5ccb506efded2f3a066187668e8 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Fri, 8 May 2015 14:32:23 +0300 Subject: [PATCH] AssemblyInfo attributes regex fix The current regex used to replace the AssemblyInformationalVersion attribute does not capture the value GitVersion actually puts there, so successive invocations of GitVersion don't overwrite that attribute. Changed the regexes to be more permissive: anything between the quotes is OK. --- GitVersionExe/AssemblyInfoFileUpdate.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GitVersionExe/AssemblyInfoFileUpdate.cs b/GitVersionExe/AssemblyInfoFileUpdate.cs index eb629b1481..87b17c66d3 100644 --- a/GitVersionExe/AssemblyInfoFileUpdate.cs +++ b/GitVersionExe/AssemblyInfoFileUpdate.cs @@ -36,9 +36,9 @@ public AssemblyInfoFileUpdate(Arguments args, string workingDirectory, VersionVa var assemblyInfoVersion = variables.InformationalVersion; var assemblyFileVersion = variables.MajorMinorPatch + ".0"; var fileContents = fileSystem.ReadAllText(assemblyInfoFile) - .RegexReplace(@"AssemblyVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyVersion(\"{0}\")", assemblyVersion)) - .RegexReplace(@"AssemblyInformationalVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion)) - .RegexReplace(@"AssemblyFileVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion)); + .RegexReplace(@"AssemblyVersion\(""[^""]*""\)", string.Format("AssemblyVersion(\"{0}\")", assemblyVersion)) + .RegexReplace(@"AssemblyInformationalVersion\(""[^""]*""\)", string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion)) + .RegexReplace(@"AssemblyFileVersion\(""[^""]*""\)", string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion)); fileSystem.WriteAllText(assemblyInfoFile, fileContents); }