nant:replace-all-in-file
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | nant:replace-all-in-file [2019/08/23 10:40] – created odefta | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Replace a string in a file with nant ====== | ||
+ | |||
+ | File content: | ||
+ | <file cpp version.cpp> | ||
+ | #include " | ||
+ | #define VERSION " | ||
+ | void main() { | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Create replace.build file to replace version with $BuildNumber: | ||
+ | < | ||
+ | < | ||
+ | <project name=" | ||
+ | <target name=" | ||
+ | | ||
+ | < | ||
+ | <regex | ||
+ | input=" | ||
+ | pattern=" | ||
+ | < | ||
+ | file=" | ||
+ | message=" | ||
+ | append=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Run it with: | ||
+ | nant -buildfile: | ||
+ | |||
nant/replace-all-in-file.txt · Last modified: 2023/07/04 19:36 by 127.0.0.1