This project is read-only.


Nov 1, 2012 at 8:20 PM

I have a simple task to perform...

1. If there is any content in a file which will always be SQL commands (inserts, updates, etc), run the file against the db.

2. ... then empty the file.

I am using the following MSBuild scripting...

    <ReadLinesFromFile File="$(DBScriptDiskFile)">
      <Output ItemName="SQLText"  TaskParameter="Lines"/>

    <File TaskAction="RemoveLines" Files="$(DBScriptDiskFile)" Lines="@(SQLText)" />

... and it seems to work, except that it never deletes the last line of the file.  Please help!

Nov 1, 2012 at 10:01 PM

According to the docs, Lines is a regex, so I'm not sure how your code is working at all. If you want to clear content, try using this


        <File TaskAction="RemoveLines" Files="$(DBScriptDiskFile)" Lines=".*" />



Marked as answer by mikeFourie on 4/20/2014 at 6:45 AM
Nov 2, 2012 at 2:43 PM

That worked! Thanks a ton!

I had tried Lines="*", but it did nothing.  I don't know why I didn't think of ".*", except that it's been a while since I have really needed a real wildcard regular expression like that.