MSBuild复制任务忽略(%RecursiveDir)

时间:2016-06-28 09:16:25

标签: msbuild msbuild-task

我在构建输出中有子目录,但文件被复制到根目标目录而不应用%RecursiveDir

<PropertyGroup>
  <slnpath>.</slnpath>
  <binpath>.\ProjName\</binpath>
  <destination>..\..\deploy\ProjName\Master</destination>
<PropertyGroup>

<ItemGroup>

 <DefaultExclude Include="$(slnpath)\.\**\*.svn-base"/>
 <DefaultExclude Include="$(slnpath)\.\**\.svn\**"/>

 <DefaultExclude Include="$(slnpath)\.\**\.git\**"/>
 <DefaultExclude Include="$(slnpath)\.\**\.hg\**"/>

 <DefaultExclude Include="$(slnpath)\.\**\*.log"/>
 <DefaultExclude Include="$(slnpath)\.\**\log\*.*" />
</ItemGroup>

<CreateItem Include="$(slnpath)\$(binpath)bin\**\*.*" Exclude="@(DefaultExclude)">
  <Output ItemName="FilesToCopy" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(FilesToCopy)" 
      DestinationFiles="@(FilesToCopy->'$(destination)\bin\%(RecursiveDir)%(Filename)%(Extension)')" />

为什么它不起作用?

令人惊讶的是,在同一个脚本中从下面的另一个源目录进行复制:

<CreateItem Include="$(slnpath)\DeployOverride\All\**\*.*" Exclude="@(DefaultExclude)">
  <Output ItemName="FilesToCopy" TaskParameter="Include" /> 
</CreateItem>
<Copy SourceFiles="@(FilesToCopy)" 
      DestinationFiles="@(FilesToCopy->'$(destination)\bin\%(RecursiveDir)%(Filename)%(Extension)')" />

0 个答案:

没有答案