<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <!-- 物理复制 Exporter 文件到项目根目录，保留目录结构 -->
    <Target Name="CopyExporterFilesToProject" BeforeTargets="PrepareForBuild">
        <ItemGroup>
            <!-- 获取需要复制的文件 -->
            <ExporterFilesToCopy Include="$(MSBuildThisFileDirectory)..\tools\output\**\*" />
        </ItemGroup>

        <ItemGroup>
            <!-- 生成目标路径，保持原有目录结构 -->
            <ExporterFilesWithDestination Include="@(ExporterFilesToCopy)">
                <DestinationPath>$(MSBuildProjectDirectory)\Tools\Exporter\ConfigTable\%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
            </ExporterFilesWithDestination>
        </ItemGroup>

        <!-- 日志输出 -->
        <Message Text="Source: %(ExporterFilesWithDestination.Identity), Destination: %(ExporterFilesWithDestination.DestinationPath)" />

        <!-- 复制文件 -->
        <Copy
                SourceFiles="@(ExporterFilesWithDestination)"
                DestinationFiles="@(ExporterFilesWithDestination->'%(DestinationPath)')"
                SkipUnchangedFiles="true" />
    </Target>
</Project>
