Filter MSBuild items Hi Guys,<br><br>Problem:<br>I'm trying to filter a item list (GroupA), with item list (GroupB) to generate GroupC. So far I have tried this using batching and Transforms with no luck. <br><br>Background:<br>GroupA is a list been generated from a custom Msbuild task. Its metadata structure cannot be changed. The idea here is to search GroupA for list of filenames contained within GroupB.<br><br><font style="" color="#0000ff" size=2> <p>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>ann.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>barry.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>claire.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>dermot.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt; </p> <p> <p></p> <p>&lt;</font><font style="" color="#a31515" size=2>GroupB</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>ann.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupB</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>barry.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br></p> <p> <p></p> <p>Possible solution:<font style="" color="#0000ff" size=2> <p></p> <p>&lt;</font><font style="" color="#a31515" size=2>CreateItem</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>@(GroupA)</font><font size=2>&quot;</font> <font style="" color="#ff0000" size=2>Condition</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>'%(GroupA.filename)' == 'ann' or '%(GroupA.filename)' == 'barry'</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2> &gt;<br>        &lt;</font><font style="" color="#a31515" size=2>Output</font> <font style="" color="#ff0000" size=2>TaskParameter</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>Include</font><font size=2>&quot;</font> <font style="" color="#ff0000" size=2>ItemName</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>GroupC</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;/</font><font style="" color="#a31515" size=2>CreateItem</font><font style="" color="#0000ff" size=2>&gt; </p> <p></p> <p></p></font> <p></p> <p><font style="" face="'verdana','sans-serif'" color=blue size=2><font color="#000000">Any help on this would be appreciated.</font></font></p> <p><font color="#000000">Thanks<br>John<br></font><br> </p></font> <p></p>© 2009 Microsoft Corporation. All rights reserved.Fri, 26 Sep 2008 09:22:07 Zc26fcc21-8b92-4c76-8d45-402f1c5d75b7http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#c26fcc21-8b92-4c76-8d45-402f1c5d75b7http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#c26fcc21-8b92-4c76-8d45-402f1c5d75b7JohnDoonerhttp://social.msdn.microsoft.com/Profile/en-US/?user=JohnDoonerFilter MSBuild items Hi Guys,<br><br>Problem:<br>I'm trying to filter a item list (GroupA), with item list (GroupB) to generate GroupC. So far I have tried this using batching and Transforms with no luck. <br><br>Background:<br>GroupA is a list been generated from a custom Msbuild task. Its metadata structure cannot be changed. The idea here is to search GroupA for list of filenames contained within GroupB.<br><br><font style="" color="#0000ff" size=2> <p>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>ann.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>barry.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>claire.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupA</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>dermot.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt; </p> <p> <p></p> <p>&lt;</font><font style="" color="#a31515" size=2>GroupB</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>ann.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;</font><font style="" color="#a31515" size=2>GroupB</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>barry.exe</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br></p> <p> <p></p> <p>Possible solution:<font style="" color="#0000ff" size=2> <p></p> <p>&lt;</font><font style="" color="#a31515" size=2>CreateItem</font> <font style="" color="#ff0000" size=2>Include</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>@(GroupA)</font><font size=2>&quot;</font> <font style="" color="#ff0000" size=2>Condition</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>'%(GroupA.filename)' == 'ann' or '%(GroupA.filename)' == 'barry'</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2> &gt;<br>        &lt;</font><font style="" color="#a31515" size=2>Output</font> <font style="" color="#ff0000" size=2>TaskParameter</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>Include</font><font size=2>&quot;</font> <font style="" color="#ff0000" size=2>ItemName</font><font style="" color="#0000ff" size=2>=</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>GroupC</font><font size=2>&quot;</font><font style="" color="#0000ff" size=2>/&gt;<br>&lt;/</font><font style="" color="#a31515" size=2>CreateItem</font><font style="" color="#0000ff" size=2>&gt; </p> <p></p> <p></p></font> <p></p> <p><font style="" face="'verdana','sans-serif'" color=blue size=2><font color="#000000">Any help on this would be appreciated.</font></font></p> <p><font color="#000000">Thanks<br>John<br></font><br> </p></font> <p></p>Wed, 24 Sep 2008 08:41:58 Z2008-09-24T08:41:58Zhttp://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#e5d0ef7a-ea37-48af-8480-884fe645b952http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#e5d0ef7a-ea37-48af-8480-884fe645b952Mike Fouriehttp://social.msdn.microsoft.com/Profile/en-US/?user=Mike%20FourieFilter MSBuild itemsI think the following will work for you<br><br> <p class=MsoNormal style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New';color:blue"><span style="">   </span>&lt;</span><span style="font-size:10pt;font-family:'Courier New';color:rgb(163, 21, 21)">FTDMsBuild</span><span style="font-size:10pt;font-family:'Courier New';color:blue"> </span><span style="font-size:10pt;font-family:'Courier New';color:red">TaskAction</span><span style="font-size:10pt;font-family:'Courier New';color:blue">=</span><span style="font-size:10pt;font-family:'Courier New'">&quot;<span style="color:blue">GetCommonItems</span>&quot;<span style="color:blue"> </span><span style="color:red">InputItems1</span><span style="color:blue">=</span>&quot;<span style="color:blue">@(GroupA)</span>&quot;<span style="color:blue"> </span><span style="color:red">InputItems2</span><span style="color:blue">=</span>&quot;<span style="color:blue">@(GroupB)</span>&quot;<span style="color:blue">&gt;</span></span></p> <p class=MsoNormal style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New';color:blue"><span style="">        </span>&lt;</span><span style="font-size:10pt;font-family:'Courier New';color:rgb(163, 21, 21)">Output</span><span style="font-size:10pt;font-family:'Courier New';color:blue"> </span><span style="font-size:10pt;font-family:'Courier New';color:red">TaskParameter</span><span style="font-size:10pt;font-family:'Courier New';color:blue">=</span><span style="font-size:10pt;font-family:'Courier New'">&quot;<span style="color:blue">OutputItems</span>&quot;<span style="color:blue"> </span><span style="color:red">ItemName</span><span style="color:blue">=</span>&quot;<span style="color:blue">GroupC</span>&quot;<span style="color:blue">/&gt;</span></span></p> <p class=MsoNormal><span style="font-size:10pt;line-height:115%;font-family:'Courier New';color:blue"><span style="">    </span>&lt;/</span><span style="font-size:10pt;line-height:115%;font-family:'Courier New';color:rgb(163, 21, 21)">FTDMsBuild</span><span style="font-size:10pt;line-height:115%;font-family:'Courier New';color:blue">&gt;</span></p> The task is in the <span id="ctl00_ctl00_Content_TabContentPanel_Content_wikiSourceLabel"><i><b>FreeToDev MSBuild Tasks Suite</b></i>, available here: </span><a href="http://www.codeplex.com/freetodevtasks"><span id="ctl00_ctl00_Content_TabContentPanel_Content_wikiSourceLabel"></span>http://www.codeplex.com/freetodevtasks</a><br><br>That task will do a bunch of other things for you too...<br><p><i>GetCommonItems</i> (<b>Required: </b>InputItems1, InputItems2 <b>Output: </b>OutputItems, ItemCount)</p> <p><i>GetDistinctItems</i> (<b>Required: </b>InputItems1, InputItems2 <b>Output: </b>OutputItems, ItemCount)</p> <p><i>GetItem</i> (<b>Required: </b>InputItems1, Position<b>Output: </b>OutputItems)</p> <p><i>GetLastItem</i> (<b>Required: </b>InputItems1<b>Output: </b>OutputItems)</p> <p><i>GetItemCount</i> (<b>Required: </b>InputItems1 <b>Output: </b>ItemCount)</p> <p><i>GetCurrentDirectory</i> (<b>Output: </b>CurrentDirectory)</p> <p><i>RemoveDuplicateFiles</i> (<b>Required: </b>InputItems1 <b>Output: </b>OutputItems, ItemCount)</p> <p><i>Sort</i> (<b>Required: </b>InputItems1<b>Output: </b>OutputItems)</p> <p><i>StringToItemCol</i> (<b>Required: </b>ItemString, Separator <b>Output: </b>OutputItems, ItemCount)</p><br> Wed, 24 Sep 2008 09:13:12 Z2008-09-24T09:13:12Zhttp://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#59524fb7-5cc1-4306-84c5-48feb7a22f5fhttp://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#59524fb7-5cc1-4306-84c5-48feb7a22f5fChris Earglehttp://social.msdn.microsoft.com/Profile/en-US/?user=Chris%20EargleFilter MSBuild items<p>I tried several different ways to make this work. I ended up having to do to two excludes to perform an inner join in MSBuild without outside tasks.<br><br></p> <div style="font-size:10pt;font-family:Monospace;background-color:white"><span style="color:blue">&lt;</span><span style="color:#a31515">CreateItem</span> <span style="color:red">Include</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">@(GroupA)</span><span style="color:black">&quot;</span> <span style="color:red">Exclude</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">@(GroupB)</span><span style="color:black">&quot;</span><span style="color:blue"> &gt;<br>    &lt;</span><span style="color:#a31515">Output</span> <span style="color:red">TaskParameter</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Include</span><span style="color:black">&quot;</span> <span style="color:red">ItemName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">GroupC</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;<br>&lt;/</span><span style="color:#a31515">CreateItem</span><span style="color:blue">&gt; <br><br>&lt;</span><span style="color:#a31515">CreateItem</span> <span style="color:red">Include</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">@(GroupA)</span><span style="color:black">&quot;</span> <span style="color:red">Exclude</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">@(GroupC)</span><span style="color:black">&quot;</span><span style="color:blue"> &gt;<br>    &lt;</span><span style="color:#a31515">Output</span> <span style="color:red">TaskParameter</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Include</span><span style="color:black">&quot;</span> <span style="color:red">ItemName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">GroupD</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;<br>&lt;/</span><span style="color:#a31515">CreateItem</span><span style="color:blue">&gt; <br><br>&lt;</span><span style="color:#a31515">Message</span> <span style="color:red">Text</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">@(GroupD)</span><span style="color:black">&quot;</span><span style="color:blue">/&gt;</span> </div><hr size="1" align="left" width="25%">KodefuGuru.com - Life Student of the Kodefu ArtsWed, 24 Sep 2008 20:53:29 Z2008-09-24T20:53:29Zhttp://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#d7863bae-7562-4358-8e53-c82f84be002bhttp://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/c26fcc21-8b92-4c76-8d45-402f1c5d75b7#d7863bae-7562-4358-8e53-c82f84be002bChris Earglehttp://social.msdn.microsoft.com/Profile/en-US/?user=Chris%20EargleFilter MSBuild items I posted a blog article explaining set operations with item collections in more detail.<br><br><a href="http://www.kodefuguru.com/post/2008/09/Set-Operations-in-MSBuild.aspx">http://www.kodefuguru.com/post/2008/09/Set-Operations-in-MSBuild.aspx</a><hr size="1" align="left" width="25%">KodefuGuru.com - Life Student of the Kodefu ArtsWed, 24 Sep 2008 23:15:41 Z2008-09-24T23:15:41Z