merge - Merging two item groups using MSBuild -


i have 2 questions:

  1. how can filter list of files (in itemgroup) extension?

  2. i have 2 lists of files read out of xml files via xmlpeek merge based on conditional. can done in msbuild?

currently, have this:

<target name="getexportfilelist">      <!-- can't use xpath filter value extension because msbuild doesn't support xpath 2.0's ends-with() function -->     <xmlpeek xmlinputpath="$(xmlfile)"              query = "//file[not(./@value = '') , not(./@value = preceding::file/@value)]/@value">          <!-- file list have files 2 different extensions, we'll call them .ext1 , ext2 files - need way split 2 itemgroups each containing 1 of file types -->          <output taskparameter="result"                 itemname="referencedfiles" />     </xmlpeek>       <!-- .ext2 files xml , contain references other .ext1 files -->     <xmlpeek xmlinputpath="$(directlyreferencedext2files)"              query="//ext1[not(./@filepath = '')]/@filepath">               <output taskparameter="result"              itemname="indirectlyreferencedext1files" />     </xmlpeek>      <!-- combine 2 lists -->     <itemgroup>         <allext1files include="@indirectlyreferencedext1files" />         <allext1files include="@directlyreferencedext1files" exclude="@allext1files" />                 </itemgroup> </target> 

so recap:

  1. i need way extract files of type .ext1 , .ext2 referencedfiles directlyreferencedext1files , directlyreferencedext2files respectively (since can't use xpath 2.0 query in msbuild)
  2. take directlyreferencedext1files , indirectlyreferencedext1files (which pulled directlyreferencedext2files) , merge them 1 list processing.

there's simple way this, i'm having trouble groking how msbuild works , find reference i'm trying (msdn more confusing helpful :))

thanks!

this standard msbuild functionality:

<itemgroup>   <referencedfiles include="a.ext1;b.ext1;c.ext2;d.ext2"/> </itemgroup>  <target name="filterit">   <itemgroup>     <directlyreferencedext1files include="%(referencedfiles.identity)" condition="'%(extension)'=='.ext1'" />     <directlyreferencedext2files include="%(referencedfiles.identity)" condition="'%(extension)'=='.ext2'" />     <allofthem include="@(directlyreferencedext1files);@(directlyreferencedext2files)" />   </itemgroup>   <message text="@(directlyreferencedext1files)" />   <message text="@(directlyreferencedext2files)" />   <message text="@(allofthem)" /> </target> 

note: questions duplicates because ask 2 of them it's hard find exact duplicates requires.. see how filter itemgroup? instance, , msbuild itemgroup condition, , how can merge 2 itemgroups in msbuild


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -