DCSIMG
Remove Items From ItemGroups In MSBuild - Maor's Blog

Remove Items From ItemGroups In MSBuild

The ability to remove entries from ItemGroups is one of the new features of MSBuild 3.5.

To remove an Item from an ItemGroup in MSBuild 2.0 you would have to create a new ItemGroup from the old one and skip the Item that you needed removed.

In MSBuild 3.5 we can achieve it by using the Remove parameter.

Example:

<ItemGroup>
    <Files Include="a.cs" />
    <Files Include="b.cs" />
    <Files Include="c.cs" />
    <Files Include="d.cs" />
    <Files Include="e.cs" />
    <Files Include="f.cs" />
    <Files Include="g.cs" />
</ItemGroup>

Some times we want to restrict some data from this group in a target. In order to do it,  we should use the Remove parameter:

<ItemGroup>
    <Files Remove="a.cs" />
    <Files Remove="e.cs" />
    <Files Remove="f.cs" />
</ItemGroup>

Read more at msdn.

Published 25 March 2008 02:03 AM by Maor David-Pur

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above:

Search

Go

This Blog

News

    RSS

     

    Connect with Me

    Maor's Facebook profile  Follow Maor on Twitter  Maor's profile on Linkedin  Maor in FriendFeed 
           

Syndication