Msbuild 将bin文件夹的内容复制到特定文件夹中

Msbuild 将bin文件夹的内容复制到特定文件夹中,msbuild,Msbuild,到目前为止,我有这个,但它不工作 <Target Name="AfterBuild"> <Copy SourceFiles="bin\" DestinationFolder="C:\temp\appServer\"></Copy> </Target> 看起来MSBuild复制任务没有为SourceFiles获取目录,而是要复制的文件列表 查看此处的MSDN文章,了解一个简单的示例: 尝试使用文件通配符 <Target

到目前为止,我有这个,但它不工作

  <Target Name="AfterBuild">
        <Copy SourceFiles="bin\" DestinationFolder="C:\temp\appServer\"></Copy>
  </Target>

看起来MSBuild复制任务没有为SourceFiles获取目录,而是要复制的文件列表

查看此处的MSDN文章,了解一个简单的示例:


尝试使用文件通配符

<Target Name="AfterBuild">
     <Copy SourceFiles="bin\*.*" DestinationFolder="C:\temp\appServer\"></Copy>
</Target>

试试这个:

<ItemGroup>
    <BinFiles Include="bin\**\*.*"/>
</ItemGroup>

<Target Name="AfterBuild">
    <Copy SourceFiles="@(BinFiles)" 
          DestinationFolder="C:\temp\appServer\"/>
</Target>

这将给出与OP相同的结果。