Change only Revision number in AssemblyInfo.cs with msbuild FileUpdate task
Posted
by Divya mohan Singh
on Stack Overflow
See other posts from Stack Overflow
or by Divya mohan Singh
Published on 2010-01-08T08:55:34Z
Indexed on
2010/06/11
20:13 UTC
Read the original article
Hit count: 342
msbuild
|msbuild-task
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?
© Stack Overflow or respective owner