Search code examples
msbuildmsbuild-taskmsbuild-propertygroupmsbuild-buildengine

how to replace string in file using msbuild?


I want to replace a string such "how r u" in file test.xml with a string "i am fine" in another file xy.xml.using regular expression in ms build.

ie i have to read string from one file(xy.xml) and replace it in another file test.xml. so please provide necessary steps to solve this issue with example


Solution

  • EDIT: This answer is obsolete. Use solution below...

    Use ReadLinesFromFile task to get replacement string from the xy.xml file. Check this

    Then use value from xy.xml as a replacement string for FileUpdate task. Check this

    And put it all together ;)