Skip to content

Instantly share code, notes, and snippets.

@JasonCozens
Created January 27, 2011 13:56
Show Gist options
  • Select an option

  • Save JasonCozens/798530 to your computer and use it in GitHub Desktop.

Select an option

Save JasonCozens/798530 to your computer and use it in GitHub Desktop.
This MSBuild script shows how to filter Items into two separate item lists. This could be used for filtering files for different installers etc .
<?xml version="1.0" encoding="utf-8"?>
<Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="4.0"
>
<ItemGroup>
<Binary Include="SrcDir/assembly01.txt" >
<Server>.</Server>
</Binary>
<Binary Include="SrcDir/assembly02.txt" >
<Server>.</Server>
<Desktop>.</Desktop>
</Binary>
<Binary Include="SrcDir/assembly03.txt" >
<Desktop>.</Desktop>
</Binary>
</ItemGroup>
<Target Name="Server" >
<Copy
DestinationFolder="Server"
SourceFiles="@(Binary)"
Condition="%(Binary.Server) != '' "
/>
</Target>
<Target Name="Desktop" >
<Copy
DestinationFolder="Desktop"
SourceFiles="@(Binary)"
Condition="%(Binary.Desktop) != '' "
/>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment