<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <!-- 物理复制 NLog 配置文件到项目根目录 -->
        <Target Name="CopyNLogFilesToProject" BeforeTargets="PrepareForBuild">
            <ItemGroup>
                <!-- 定义源文件路径，指向 NuGet 包中的文件 -->
                <FilesToCopy Include="$(MSBuildThisFileDirectory)..\build\NLog.config" />
                <FilesToCopy Include="$(MSBuildThisFileDirectory)..\build\NLog.xsd" />
            </ItemGroup>
            <!-- 仅当目标文件不存在时才执行复制操作 -->
            <Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(MSBuildProjectDirectory)" Condition="!Exists('$(MSBuildProjectDirectory)\NLog.config')" SkipUnchangedFiles="true" />
            <Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$(MSBuildProjectDirectory)" Condition="!Exists('$(MSBuildProjectDirectory)\NLog.xsd')" SkipUnchangedFiles="true" />
            <ItemGroup>
                <!-- 使用 Include 确保文件在解决方案中显示 -->
                <None Include="$(MSBuildProjectDirectory)\NLog.config">
                    <!-- 确保复制到输出目录，并设置复制模式 -->
                    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                </None>
                <None Include="$(MSBuildProjectDirectory)\NLog.xsd">
                    <!-- 确保复制到输出目录，并设置复制模式 -->
                    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
                </None>
            </ItemGroup>
        </Target>
</Project>
