I'm trying to copy several files in the $(TargetDir) to another folder (e.g. C:\BinCache), but for whatever reason I cannot get MSBuild to stop complaining.
  <Target Name="AfterBuild">
    <Copy SourceFiles="$(TargetDir)\*.*"
          DestinationFolder="C:\BinCache" />
  </Target>
What am I doing wrong here?
EDIT: The solution is to use a CreateItem task. Presumably, Visual Studio 2008 removes this restriction. Thanks Scott!
<Target Name="AfterBuild">
  <CreateItem Include="$(TargetDir)\*.*">
    <Output TaskParameter="Include" ItemName="SourceFiles" />
  </CreateItem>
  <Copy SourceFiles="@(SourceFiles)" DestinationFolder="C:\BinCache" />  
</Target>
                SourceFiles needs to be an Item list
you'll need something like
<Target Name="AfterBuild">
  <ItemGroup>
    <SourceFiles Include="$(TargetDir)\*.*" />
  </ItemGroup>
  <Copy SourceFiles="@(SourceFiles)" DestinationFolder="C:\BinCache" />  
</Target>
Just noticed you're on 2005, in that case you'll need to use the CreateItem task
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With