我只需要更改AssemblyInfo.cs文件的修订号.版本号的格式为 Major.Minor.Build.Revision ,例如1.4.6.0.
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.
当前,我使用FileUpdate任务(从 MSBuild社区任务项目)来更改版本,以下正则表达式:
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?
推荐答案这是怎么回事:
<FileUpdate Files="Properties/AssemblyInfo.cs" Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)" ReplacementText="$1.$2.$3.$(Revision)" />更多推荐
使用MSBuild FileUpdate任务仅更改AssemblyInfo.cs中的修订号
发布评论