Reputation: 170549
I have a folder with files that have names starting with App_Web_
and ending with .dll
. I don't know what's in between those parts and I don't know the number of files. I need MSBuild to move those files into another folder.
So I composed this:
<Move
SourceFiles="c:\source\App_Web_*.dll"
DestinationFolder="c:\target"
/>
but when the target runs I get the following output:
error MSB3680: The source file "c:\source\App_Web_*.dll" does not exist.
The files are definitely there.
What am I doing wrong? How do I have the files moved?
Upvotes: 13
Views: 9114
Reputation: 4991
You cannot use regular expression directly in task parameters. You need to create an item containing list of files to move and pass its content to the task:
<ItemGroup>
<FilesToMove Include="c:\source\App_Web_*.dll"/>
</ItemGroup>
MSBuild will expand regular expression before passing it to the task executor. So later in some target you may invoke Move
task:
<Target Name="Build">
<Move
SourceFiles="@(FilesToMove)"
DestinationFolder="C:\target"
/>
</Target>
Upvotes: 20