File.Replace Task with Regex

Jan 9, 2009 at 5:44 PM
Edited Jan 9, 2009 at 9:08 PM
I'm trying to add a folder to my project file, I've verified that the regex I'm using does indeed match what I want it to via other means, but the task doesn't seem to want to execute the replace.  Suggestions?

<File.Replace
Path="$(SolutionRoot)\MyProj\MyProj.csproj"
RegularExpression="^&lt;/Project&gt;"
NewValue="  &lt;ItemGroup&gt;\n    &lt;Folder Include=&quot;DBUpdates\DBUpdate_Pending\&quot; /&gt;\n  &lt;/ItemGroup&gt;\n&lt;/Project&gt;"
/>
It works if use OldValue instead, however, because the old value isn't a regular expression it replaces all the </Project>, which there are several, when I really just want to replace the one that starts at the beginning of a new line.  Any suggestions would be appreciated.  Thank you.