Mac's avatar

MacReiben Web Zone

Christian Finel, software craftsman, DDs stuffs addict - @macreiben.

MSBuild: Copier un dossier avec wildcards

This is a little trick to copy files from a regular expression with MSBuild.

With this example it becomes possible to use wildcards to identity to elements to copy.

<Target Name="BeforeBuild">
[...]
<ItemGroup>
  <\_FoldersToCopy Include="$(ProjectDir)MyFolder\*TargetFolderSuffix\*.ext" />
</ItemGroup>
<Copy SourceFiles="@(_FoldersToCopy)"
  DestinationFolder="@(_FoldersToCopy->'$(TargetDir)MyFolder\%(RecursiveDir)')" />
[...]
</Target>

This is very useful when you application uses a plugin pattern and you wish to copy all the libraries to the output directory.

Remarques


Share