Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding out-of-date or missing dependencies or output files in a Visual C++ solution (or: Why does VS insist on rebuilding projects without changes?)

I've got a solution containing multiple projects. I'm only changing the code in one of them, but every time I hit Ctrl+Shift+B, Visual Studio rebuilds all of the others.

I want it to build the other projects, so this is good. What's not good is that, normally, it would see that there was nothing to do. I have a wonky dependency somewhere, so this isn't working.

Is there a tool or macro (or switch) that'll explore the dependency tree and tell me which files are missing or out-of-date, so that I can get it to stop?

I know that I can solve this specific case, by (e.g.) touching all of the project files.

Unfortunately, I've often seen this situation when a file is configured to produce an output file (e.g. an IDL file is configured to output a typelibrary, but doesn't contain a 'library' block, so it'll never create a TLB).

This wouldn't be resolved by touching all of the project files, so I'm looking for something more general to add to my personal toolbox that'll easily tell me why a file is being rebuilt, whether it be because it's older than a dependency, or because the project is misconfigured to expect an output file that will never be produced.

like image 512
Roger Lipscombe Avatar asked Nov 05 '22 22:11

Roger Lipscombe


1 Answers

In Options / Projects and Solutions / Build and Run turn up the MSBuild project build output verbosity to Detailed. It should give you an idea of why it is rebuilding all the projects.

like image 118
Kris Erickson Avatar answered Nov 15 '22 06:11

Kris Erickson