Reputation: 164
I'm using Visual Studio Enterprise 2019, and I'm curious about something I've noticed for a long time but never asked because it's not breaking anything: when building a solution, the final message looks like:
========== Build: 37 succeeded, 0 failed, 168 up-to-date, 0 skipped ==========
My understanding is that VS will only build files that changed (directly or via a dependency). But that doesn't seem to be the case, here's what I get after running several builds back to back right after the first build mentioned above and without making any changes to any part of the solution:
========== Build: 15 succeeded, 0 failed, 190 up-to-date, 0 skipped ==========
========== Build: 5 succeeded, 0 failed, 200 up-to-date, 0 skipped ==========
========== Build: 16 succeeded, 0 failed, 189 up-to-date, 0 skipped ==========
========== Build: 5 succeeded, 0 failed, 200 up-to-date, 0 skipped ==========
========== Build: 22 succeeded, 0 failed, 183 up-to-date, 0 skipped ==========
....and so on.
But I don't remember ever getting:
========== Build: 0 succeeded, 0 failed, 205 up-to-date, 0 skipped ==========
Why?
Note: I have seen "0 succeeded" in smaller solutions, so it's not like it never happens
Upvotes: 3
Views: 1520
Reputation: 5208
Projects are MSBuild files. Either directly or implicitly MSBuild is trying to check inputs against outputs to determine if a target should be run.
On the highest verbosity level which is 'diagnostic', MSBuild will provide information on why a project is being built.
But, in no specific order, here are some common situations that will cause a project to always build:
CopyToOutputDirectory
attribute and the values Always
and PreserveNewest
are "Copy Always" and "Copy if newer", respectively.Copy
task can replace usages like this. The Copy
task has implicit inputs and outputs and runs in-process. Other commands can be run via an Exec
task.Upvotes: 8