Skip to content

Commit ec2a678

Browse files
committed
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.
1 parent 6276276 commit ec2a678

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

GitVersionExe/AssemblyInfoFileUpdate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public AssemblyInfoFileUpdate(Arguments args, string workingDirectory, VersionVa
3636
var assemblyInfoVersion = variables.InformationalVersion;
3737
var assemblyFileVersion = variables.MajorMinorPatch + ".0";
3838
var fileContents = fileSystem.ReadAllText(assemblyInfoFile)
39-
.RegexReplace(@"AssemblyVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyVersion(\"{0}\")", assemblyVersion))
40-
.RegexReplace(@"AssemblyInformationalVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion))
41-
.RegexReplace(@"AssemblyFileVersion\(""\d+.\d+.\d+(.(\d+|\*))?""\)", string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion));
39+
.RegexReplace(@"AssemblyVersion\(""[^""]*""\)", string.Format("AssemblyVersion(\"{0}\")", assemblyVersion))
40+
.RegexReplace(@"AssemblyInformationalVersion\(""[^""]*""\)", string.Format("AssemblyInformationalVersion(\"{0}\")", assemblyInfoVersion))
41+
.RegexReplace(@"AssemblyFileVersion\(""[^""]*""\)", string.Format("AssemblyFileVersion(\"{0}\")", assemblyFileVersion));
4242

4343
fileSystem.WriteAllText(assemblyInfoFile, fileContents);
4444
}

0 commit comments

Comments
 (0)