Hi All I think it will be wonderful to have a Replace task in Nant, much like it is in ANT http://ant.apache.org/manual/CoreTasks/replace.html .
This is specially useful for cases like changing the value of the project URL when using Solution task. Case in point is the following that I had to write to change "http://localhost/ipm/ipm.csproj" project URL to <build.dir>/ipm/ipm.csproj in order for my .csproj to compile using NANT's solution task. (Pardon me for a pathetic algorithm of deleting and recreating the ipm.sln file.) public static void ScriptMain(Project project) { FileInfo fileInfo = new FileInfo(project.BaseDirectory + "\\ipm.sln"); FileStream file = File.Open(fileInfo.ToString(), FileMode.Open, FileAccess.ReadWrite); StreamReader reader = new StreamReader(file); string line = null; line = reader.ReadToEnd(); if(line.IndexOf("http://localhost/ipm") != -1) { //Console.WriteLine(line); StringBuilder sb = new StringBuilder(line); sb.Replace("http://localhost/ipm/", project.BaseDirectory+"\\"); line = sb.ToString(); reader.Close(); fileInfo.Delete(); Console.WriteLine(line); // output the changed file contents just for verbosity file = File.Open(project.BaseDirectory+"\\ipm.sln", FileMode.CreateNew, FileAccess.Write); StreamWriter writer = new StreamWriter(file); writer.AutoFlush = true; writer.WriteLine(line); } file.Close(); } Please provide me with your input. Thanks in advance. -daya ------------------------------------------------------- This SF.net email is sponsored by Dice.com. Did you know that Dice has over 25,000 tech jobs available today? From careers in IT to Engineering to Tech Sales, Dice has tech jobs from the best hiring companies. http://www.dice.com/index.epl?rel_code=104 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users