如何在msbuild上等待复制进程

如何在msbuild上等待复制进程,msbuild,Msbuild,我创建了将文件从一个文件夹复制到另一个文件夹的示例(使用msbuild)。我尝试在复制后检查文件是否已移动?但消息仍然显示,文件并没有移动。但当我在文件夹上看到时,文件移动成功。那么它是如何修复的呢 <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyG

我创建了将文件从一个文件夹复制到另一个文件夹的示例(使用msbuild)。我尝试在复制后检查文件是否已移动?但消息仍然显示,文件并没有移动。但当我在文件夹上看到时,文件移动成功。那么它是如何修复的呢

        <?xml version="1.0" encoding="utf-8"?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
    <PathPackage>C:\Users\test\Desktop\test\1\*.txt</PathPackage>
    <Files>C:\Users\test\Desktop\test\2\*.*</Files>
    </PropertyGroup>
        <ItemGroup>
            <Packages Include="$(PathPackage)"/>
            <FilesOnFolder Include="$(Files)"/>
        </ItemGroup>

        <Target Name="B">
            <Message Importance="normal" Text="Package before copy:@(Packages)"/>
            <CreateItem Include="@(Packages)">
                <Output TaskParameter="Include" ItemName="FilesToMove" />
            </CreateItem>
            <Copy
                SourceFiles="@(Packages)"
                DestinationFolder="C:\Users\test\Desktop\test\2"
            />

             <Delete Files="@(Packages)" />
            <Message Importance="normal" Text="Package after package:@(Packages)"/><!--It's full! -->
            <Message Importance="normal" Text="Destination Folder:@(FilesOnFolder)"/>  <!--It's empty! -->
        </Target>   
    </Project>

C:\Users\test\Desktop\test\1\*.txt
C:\Users\test\Desktop\test\2\**

问题在ItemGroup中。它需要写在目标内部。

我很久以来一直在寻找这个答案:)