 <p>You can implement expected behaviour with biltin features of MSBuild 4:</p> <pre><code> &lt;ItemGroup&gt; &lt;DeploymentProjects Include="1_deploy" /&gt; &lt;DeploymentProjects Include="2_deploy" /&gt; &lt;/ItemGroup&gt; &lt;Target Name="CopyMidTierBuildOutput" &gt; &lt;Message Text="Copying midTier Build Output" Importance="High"/&gt; &lt;ItemGroup&gt; &lt;MidTierDeploys Include="$(DeploymentRoot)**\%(DeploymentProjects.Identity)\$(Configuration)\**\*.*"&gt; &lt;DeploymentProject&gt;%(DeploymentProjects.Identity)&lt;/DeploymentProject&gt; &lt;/MidTierDeploys&gt; &lt;/ItemGroup&gt; &lt;Msbuild Targets="CopyDeploymentItem" Projects="$(MSBuildProjectFile)" Properties="ItemFullPath=%(MidTierDeploys.FullPath);ItemRecursiveDir=%(MidTierDeploys.RecursiveDir);ItemDeploymentProject=%(MidTierDeploys.DeploymentProject);Configuration=$(Configuration);DestFolder=$(DestFolder)" /&gt; &lt;/Target&gt; &lt;Target Name="CopyDeploymentItem" &gt; &lt;PropertyGroup&gt; &lt;ItemExcludePath&gt;$(ItemDeploymentProject)\$(Configuration)&lt;/ItemExcludePath&gt; &lt;ItemDestRecursiveDirIndex&gt;$(ItemRecursiveDir.IndexOf($(ItemExcludePath))) &lt;/ItemDestRecursiveDirIndex&gt; &lt;ItemExcludePathLength&gt;$(ItemExcludePath.Length)&lt;/ItemExcludePathLength&gt; &lt;ItemSkippingCount&gt;$([MSBuild]::Add($(ItemDestRecursiveDirIndex), $(ItemExcludePathLength)))&lt;/ItemSkippingCount&gt; &lt;ItemDestRecursiveDir&gt;$(ItemRecursiveDir.Substring($(ItemSkippingCount)))&lt;/ItemDestRecursiveDir&gt; &lt;/PropertyGroup&gt; &lt;Copy SourceFiles="$(ItemFullPath)" DestinationFolder="$(DestFolder)/MidTier/$(ItemDeploymentProject)/$(ItemDestRecursiveDir)" ContinueOnError="false" /&gt; &lt;/Target&gt; </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/library/dd633440.aspx" rel="nofollow">Property functions</a> for more info.</p>