tags:

views:

19

answers:

1

I have a msbuild task that outputs to a file.

Now I want to search that file for a certain text or regex expression and return true if it is there and false if it isn't

any idea of a task that could do this for me?

+3  A: 

If you're using MSBuild 4 (with Visual Studio 2010), you can use Property Functions and do this without any custom task:

<IsMyFileMatching>$([System.Text.RegularExpressions.Regex]::IsMatch($([System.File]::ReadAllText("yourfile"), "pattern")))</IsMyFileMatching>
Julien Lebosquain
Sweet - didn't know about this.
Preet Sangha