It is possible to do this kind of conversion with msbuild -


it possible kind of conversion msbuild? transforming metadata items?

this:

<itemgroup>    <group include="g1">       <a>1</a>       <b>1</b>     </group>      <group include="g2">        <a>2</a>        <b>2</b>     </group> </itemgroup> 

to this:

<itemgroup>     <a>1</a>     <a>2</a>      <b>1</b>     <b>2</b> </itemgroup> 

you can use batching:

this creates new item groups abd b based on group. new item groups don't have use same name metadata. set itemname in createitem/output use different name.

<?xml version="1.0" encoding="utf-8"?> <project     xmlns="http://schemas.microsoft.com/developer/msbuild/2003"     toolsversion="4.0"     defaulttargets="default">      <itemgroup>         <group include="g1">             <a>1</a>             <b>1</b>         </group>         <group include="g2">             <a>2</a>             <b>2</b>         </group>     </itemgroup>      <target name="default">         <message text="@(group)" importance="high" />          <createitem include="%(group.a)">             <output taskparameter="include" itemname="a" />         </createitem>         <createitem include="%(group.b)" additionalmetadata="from=%(group.identity)">             <output taskparameter="include" itemname="b" />         </createitem>          <message text="a=@(a)" importance="high" />         <message text="b=@(b):%(b.from)" importance="high" />     </target>  </project> 

the new "b" group defines metadata item called gives each item original item group name copied from.

update: msbuild 3.5 or newer can use instead of createitem:

<itemgroup>     <a include="%(group.a)" />     <b include="%(group.b)">         <from>%(group.identity)</from>     </b> </itemgroup> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -