I need to change only the revision number of an AssemblyInfo.cs
file. The version number is in the format Major.Minor.Build.Revision e.g. 1.4.6.0
.
Currently I change the version with the FileUpdate
task (from the MSBuild Community Tasks Project) and the following regex:
<FileUpdate Files="@(AssemblyResult)"
Regex='(\[\s*assembly:\s*AssemblyVersion\(\s*"[^\.]+\.[^\.]+)\.([^\.]+)(\.)([^\.]+)("\)\s*\])'
ReplacementText='[assembly: AssemblyVersion("$(AssemblyMajorNumber).$(AssemblyMinorNumber).$(AssemblyBuildNumber).$(Revision)")]' />
Now I need to update only the revision number and leave major,minor and build unchanged. So, is there any task to do this? Or can it be done with a regex? What would be the regular expression then?
How about this:
<FileUpdate Files="Properties/AssemblyInfo.cs"
Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)"
ReplacementText="$1.$2.$3.$(Revision)" />