Fix: Copy .dat files to dependent project outputs (including transitive dependencies) #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
当库项目(Lib1)使用
LuYao.ResourcePacker.MSBuild生成 .dat 文件时,引用该库的应用项目(App1)的输出目录中不包含 .dat 文件。Changes
Modified
LuYao.ResourcePacker.MSBuild.targets:PackResourcesto runBeforeTargets="AssignTargetPaths"(wasBeforeTargets="CopyFilesToOutputDirectory")Noneitem group withCopyToOutputDirectory="PreserveNewest"andLinkmetadata immediately after creationAssignTargetPathsto process the item for copying to referencing projectsCreated test projects:
examples/Lib1- Library project with resource packing enabledexamples/App1- Application project that references Lib1examples/Lib2,examples/Lib3- Additional library projects to test multi-layer transitive dependenciesExample
Results
Single-layer dependency: When App1 references Lib1,
Lib1.datnow appears inApp1/bin/Debug/net8.0/.Multi-layer transitive dependencies: When App1 → Lib3 → Lib2 → Lib1, all three .dat files (Lib1.dat, Lib2.dat, Lib3.dat) correctly appear in App1's output directory. MSBuild's
MSBuildCopyContentTransitivelyfeature (enabled by default) ensures .dat files propagate through the entire dependency chain.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.