diff --git a/NetRevisionTask/AssemblyInfoHelper.cs b/NetRevisionTask/AssemblyInfoHelper.cs index d479655..17e9234 100644 --- a/NetRevisionTask/AssemblyInfoHelper.cs +++ b/NetRevisionTask/AssemblyInfoHelper.cs @@ -78,6 +78,7 @@ public AssemblyInfoHelper(string projectDir, bool throwOnMissingFile, ILogger lo /// Indicates whether only the last number is replaced by the revision number. /// Indicates whether the copyright year is replaced. /// Indicates whether the final informational version string is displayed. + /// Indicates wheter all properties should be processed. /// The name of the patched AssemblyInfo file. public string PatchFile( string patchedFileDir, @@ -87,7 +88,8 @@ public string PatchFile( bool informationalAttribute, bool revOnly, bool copyrightAttribute, - bool echo) + bool echo, + bool processAnyProperty) { logger?.Trace($@"Patching file ""{fileName}""..."); ReadFileLines(FullFileName); @@ -111,7 +113,7 @@ public string PatchFile( } // Process all lines in the file - ResolveAllLines(rf, simpleAttributes, informationalAttribute, revOnly, copyrightAttribute, echo); + ResolveAllLines(rf, simpleAttributes, informationalAttribute, revOnly, copyrightAttribute, echo, processAnyProperty); // Write all lines to the file string patchedFileName = Path.Combine(patchedFileDir, "Nrt" + Path.GetFileName(fileName)); @@ -250,7 +252,8 @@ private void WriteFileLines(string patchedFileName) /// Indicates whether only the last number is replaced by the revision number. /// Indicates whether the copyright year is replaced. /// Indicates whether the final informational version string is displayed. - private void ResolveAllLines(RevisionFormatter rf, bool simpleAttributes, bool informationalAttribute, bool revOnly, bool copyrightAttribute, bool echo) + /// Indicates wheter all properties should be processed. + private void ResolveAllLines(RevisionFormatter rf, bool simpleAttributes, bool informationalAttribute, bool revOnly, bool copyrightAttribute, bool echo, bool processAnyProperty) { // Preparing a truncated dotted-numeric version if we may need it string truncVersion = null; @@ -385,6 +388,16 @@ private void ResolveAllLines(RevisionFormatter rf, bool simpleAttributes, bool i logger?.Trace($@" Replaced ""{match.Groups[2].Value}"" with ""{copyrightText}""."); } } + + if (processAnyProperty && !string.IsNullOrEmpty(lines[i])) + { + string newline = rf.Resolve(lines[i]); + if(newline != lines[i]) + { + lines[i] = newline; + logger?.Trace($@" Replaced ""{lines[i]}"" with ""{newline}""."); + } + } } } diff --git a/NetRevisionTask/Tasks/PatchAssemblyInfo.cs b/NetRevisionTask/Tasks/PatchAssemblyInfo.cs index 154be36..9cd5c59 100644 --- a/NetRevisionTask/Tasks/PatchAssemblyInfo.cs +++ b/NetRevisionTask/Tasks/PatchAssemblyInfo.cs @@ -93,6 +93,11 @@ public class PatchAssemblyInfo : MSBuildTask /// public bool ShowRevision { get; set; } + /// + /// Gets or sets a value indicating whether all properties are processed. + /// + public bool ProcessAnyProperty { get; set; } + #endregion Properties #region Task output properties @@ -157,7 +162,8 @@ public override bool Execute() ResolveInformationalAttribute, RevisionNumberOnly, ResolveCopyright, - ShowRevision); + ShowRevision, + ProcessAnyProperty); } catch (FormatException ex) { diff --git a/NetRevisionTask/Tasks/SetVersion.cs b/NetRevisionTask/Tasks/SetVersion.cs index a4a1823..69f9ddd 100644 --- a/NetRevisionTask/Tasks/SetVersion.cs +++ b/NetRevisionTask/Tasks/SetVersion.cs @@ -70,6 +70,11 @@ public class SetVersion : MSBuildTask /// public bool ShowRevision { get; set; } + /// + /// Gets or sets a value indicating whether all properties are processed. + /// + public bool ProcessAnyProperty { get; set; } + #endregion Properties #region Task output properties diff --git a/NetRevisionTask/build/Unclassified.NetRevisionTask.targets b/NetRevisionTask/build/Unclassified.NetRevisionTask.targets index 2520eda..2b0e8ce 100644 --- a/NetRevisionTask/build/Unclassified.NetRevisionTask.targets +++ b/NetRevisionTask/build/Unclassified.NetRevisionTask.targets @@ -15,6 +15,7 @@ true v[0-9]* true + false @@ -31,7 +32,8 @@ RemoveTagV="$(NrtRemoveTagV)" ResolveCopyright="$(NrtResolveCopyright)" Copyright="$(Copyright)" - ShowRevision="$(NrtShowRevision)"> + ShowRevision="$(NrtShowRevision)" + ProcessAnyProperty="$(NrtProcessAnyProperty)"> @@ -66,7 +68,8 @@ ResolveInformationalAttribute="$(NrtResolveInformationalAttribute)" RevisionNumberOnly="$(NrtRevisionNumberOnly)" ResolveCopyright="$(NrtResolveCopyright)" - ShowRevision="$(NrtShowRevision)"> + ShowRevision="$(NrtShowRevision)" + ProcessAnyProperty="$(NrtProcessAnyProperty)">