I'm trying to copy a bunch of files whose names begin with the prefix DR__
, but the copies must have that prefix removed. That is, DR__foo
must be copied as foo
. I'm trying this, which is based in the example provided in the documentation (the .chm):
<Target Name="CopyAuxiliaryFiles">
<MakeDir Directories="$(TargetDir)Parameters" Condition="!Exists('$(TargetDir)Parameters')" />
<ItemGroup>
<ContextVisionParameterFiles Include="$(SolutionDir)CVParameters\DR__*" />
</ItemGroup>
<Message Text="Files to copy and rename: @(ContextVisionParameterFiles)"/>
<RegexReplace Input="@(ContextVisionParametersFiles)" Expression="DR__" Replacement="">
<Output ItemName ="DestinationFullPath" TaskParameter="Output" />
</RegexReplace>
<Message Text="Renamed Files: @(DestinationFullPath)"/>
<Copy SourceFiles="@(ContextVisionParameterFiles)" DestinationFiles="@(DestinationFullPath)" />
</Target>
DestinationFullPath
comes out empty (or that's what I see when I display it with Message
). Thus, Copy
fails because no DestinationFiles
are specified. What's wrong here?
Edit: ContextVisionParameterFiles is not empty, it contains this:
D:\SVN.DRA.WorkingCopy\CVParameters\DR__big_bone.alut;D:\SVN.DRA.WorkingCopy\CVParameters\DR__big_medium.gop
They're actually 40 files, but I trimmed it for the sake of clarity
Got it! It seems to have been the combination of a stupid error and a seemingly compulsory parameter. As for the first one, there were two Targets called
CopyAuxiliaryFiles
. As for the second one, it seems theCount
parameter is needed.The final, working version:
Notice that:
@(CvParamFiles, '
')
syntax, which seems to replace;
with line breaksCount="1"
is now passed to RegexReplace