(Not a duplicate of can you deploy data and no assemblies via a nuget package? since the package structure has changed in the past 12 years)
I have some large test data files that I want to deploy into a known location relative to the test project that uses them. This is not for publication or deployment, just during development. It is important that I be able to specify the relative location of the files (i.e. not inside OutputDir or bin/x64/Debug/net6.0 etc), but since I control both sides of the package and consumer I'm happy to be able to specify it on either side.
For CI convenience, this should happen within normal dotnet restore. If it requires a build stage that should not re-copy files unless they have changed.
(sub-question: where is the most detailed "dotnet restore" docuementation? There seem to be a lot of magic package folders that are defined to do various things?)
Here are several approaches to deploy large test data files into a known location relative to the test project during development, ensuring CI compatibility and efficient copying:
1. Using a Custom Target in the Test Project:
2. Copying Files During Pre-Build:
3. Leveraging a Separate Package:
4. Utilizing a Post-Restore Script:
.csprojfile.Key Considerations:
Additional Tips:
SkipUnchangedFiles="true"in copying tasks to minimize redundant copies.