I wanted to replace some strings in files using my deployment MSbuild script.
I’ve noticed that MSBuild Community Tasks Project has RegexReplace task.
But when I’ve looked in documentation
(By the way, it will be good if Reference help will be available online, not only from download)
I’ve realized that the task is applicable for strings(e.g file names) not to content within a file.
Almost accidently in one of the posts i’ve found a reference to FileUpdate
task, that support Regex and does content replacements within a file.
The following examle (from downloaded help) search for a version number and update the revision.
<FileUpdate Files="version.txt" Regex="(d+).(d+).(d+).(d+)" ReplacementText="$1.$2.$3.123" />
Note: don’t forget to insert in to your project
You may require to change MSBuildCommunityTasksPath if it is not in current directory.