diff --git a/buildTransitive/EmptyFiles.targets b/buildTransitive/EmptyFiles.targets new file mode 100644 index 0000000..427bde5 --- /dev/null +++ b/buildTransitive/EmptyFiles.targets @@ -0,0 +1,32 @@ + + + + $(MSBuildThisFileDirectory)..\files + + + + + + $(TargetDir)EmptyFiles + $(IntermediateOutputPath)EmptyFiles.copied + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 1d97cf8..05518ef 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;CS0649;NU5119;NU1608;NU1109 - 8.17.0 + 8.17.1 preview 1.0.0 A collection of minimal binary files. diff --git a/src/EmptyFiles.slnx b/src/EmptyFiles.slnx index 587dabe..e8733f9 100644 --- a/src/EmptyFiles.slnx +++ b/src/EmptyFiles.slnx @@ -1,6 +1,7 @@ + diff --git a/src/EmptyFiles/EmptyFileTargets.md b/src/EmptyFiles/EmptyFileTargets.md new file mode 100644 index 0000000..1bc15c7 --- /dev/null +++ b/src/EmptyFiles/EmptyFileTargets.md @@ -0,0 +1,18 @@ +How it works: + + 1. Inputs="$(MSBuildThisFileFile)" - Tracks the package file timestamp + 2. Outputs="$(EmptyFilesMarker)" - Tracks a marker file in the output directory + 3. MSBuild automatically skips the target if all outputs are newer than all inputs + 4. SkipUnchangedFiles="true" - Additional optimization to skip individual unchanged files + 5. Touch - Updates the marker file timestamp after successful copy + +This will only copy files when: + + 1. The targets is newer than the marker file, OR + 2. The marker file doesn't exist (first build/clean build) + +Benefits: + + * Dramatically reduces IO on incremental builds + * Works with dotnet clean (removes marker file) + * Still respects individual file changes via SkipUnchangedFiles diff --git a/src/EmptyFiles/EmptyFiles.csproj b/src/EmptyFiles/EmptyFiles.csproj index 21f2e74..4d47847 100644 --- a/src/EmptyFiles/EmptyFiles.csproj +++ b/src/EmptyFiles/EmptyFiles.csproj @@ -12,9 +12,9 @@ - - - + + + true files diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj index 07b035e..19625b1 100644 --- a/src/Tests/Tests.csproj +++ b/src/Tests/Tests.csproj @@ -16,5 +16,5 @@ - + \ No newline at end of file