<Project>
    <Target Name="AfterTargetsBuild" AfterTargets="Build">
        <ItemGroup>
            <PackageReferenceFiles
                Condition="%(PackageReference.CopyToOutputDirectory) != ''"
                Include="$(NugetPackageRoot)\%(PackageReference.Identity)\%(PackageReference.Version)\%(PackageReference.CopyToOutputDirectory)" />
        </ItemGroup>
        <Copy SourceFiles="@(PackageReferenceFiles)" DestinationFolder="$(OutDir)" />
    </Target>
</Project>