将dll复制到子目录msbuild

时间:2014-01-19 02:22:30

标签: c# msbuild

我正在尝试构建一个项目,我希望将dll放入单独的bin文件夹中。我尝试使用Deploy Include但它没有帮助。你做正确的方法是什么?

 <ItemGroup>
    <Deploy Include="$(Outdir)$(TargetFileName)" />
    <Deploy Include="$(Outdir)$(TargetName).pdb" />
    <Deploy Include="$(Outdir)">
      <FileMatch>*.dll *.pdb</FileMatch>
      <Subdir>bin</Subdir>
    </Deploy>
  </ItemGroup>

1 个答案:

答案 0 :(得分:0)

您需要两个单独的项目组,一个用于exe,另一个用于dll

<ItemGroup>
  <Deploy Include="$(Outdir)$(TargetFileName)" />
  <Deploy Include="$(Outdir)$(TargetName).pdb" />
  <DeployBin Include="$(Outdir)*.dll" />
  <DeployBin Include="$(Outdir)*.pdb" Exclude="$(Outdir)$(TargetName).pdb" />
</ItemGroup>

您可以像这样复制文件:

<Copy SourceFiles="@(Deploy)"
      DestinationFiles="$(MyDeployFolder)" />
<Copy SourceFiles="@(DeployBin)"
      DestinationFiles="$(MyDeployFolder)\bin" />