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 r
If you prefer not using third party (community) binaries, nor embedding code into your msbuild project, I'd suggest creating a simple task library which implements File.WriteAllText and can later host other tasks :
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
public class FileWriteAllText : Task
{
[Required]
public string Path { get; set; }
[Required]
public string Contents { get; set; }
public override bool Execute()
{
File.WriteAllText(Path, Contents);
return true;
}
}
Then you can replace, append, etc. in msbuild :