Monday, 7 January 2013

Conditional String Concat

I was unable to find a way to allow conditional concat of strings, thus had to resort to the following

    <ItemGroup>
      <Docs Include="docs\*.*" /> 
    </ItemGroup>


    <WriteLinesToFile  File="DocumentNotInPdf.txt" 
     Condition="!$(LinesFromReadFile.Contains('%(Docs.FileName)'))" 
     Lines="%(Docs.FileName)%(Docs.Extension) "/>

    <ReadLinesFromFile File="DocumentNotInPdf.txt">
      <Output TaskParameter="Lines" PropertyName="DocNoPdf"/>
    </ReadLinesFromFile>
    
     <MSBuild.Community.Tasks.Mail Condition="Exists('DocumentNotInPdf.txt')"
        SmtpServer="smtp"
        To=""
        From=""
        Subject="CheckDocToPdf"
        Body="Files not in docToPdf121.bat - $(DocNoPdf)."
                                         
       />