dotnet / dotnet/msbuild

Fast up-to-date check fails when any dependency has it disabled and has CopyLocal references

Open
#3,762 1 comment 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

When a project A includes `CopyLocal` references, and has `DisableFastUpToDateCheck` set to true, every build will always touch the `CopyUpToDateMarker`.

This in turn ensures that no project B depending on this project A is ever considered as being up-to-date (because a project is considered out of date if the `CopyUpToDateMarker` of any of its dependency is more recent than the last build time). This behaviour is observed even though the `CopyLocal` references of project A remain unchanged across builds.

I would instead expect that even though project A has disabled the fast check, its build should be a no-op when it's up-to-date, and projects depending on it should still be considered up-to-date in that case.

To fix this locally, I have overriden `_CopyFilesMarkedCopyLocal` target to define its `Inputs` and `Outputs`. When this is done, the target doesn't run when the `CopyLocal` references are unchanged, the `CopyUpToDateMarker` remains untouched, and my projects depending on project A remain up-to-date.

As I'm not super familiar with the codebase I'm not sure that the right solution is to boldly define these in `Microsoft.Common.CurrentVersion.targets`. However I wonder what would be the best way to improve the behaviour I'm describing?

Many thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.