views:

613

answers:

8

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.

A: 

Well why not just rebuild the project then and not the whole solution?

nportelli
A: 

Not that I've found. If you know that a project is not going to change often, you can tell the Configuration Manager not to build it. (Right-click on the Solution, and select Configuration Management)

James Curran
A: 

As far as I know ctrl + shift + b is by default bound to BuildSolution, so that would be why all your projects are being build. i'm not really sure what else you could use except for rightclicking the project and pressing build :)

thmsn
All of the projects are being built -- this is what I want. Ordinarily, the dependency checker will cause the compiler to not actually do anything.This is not working.
Roger Lipscombe
A: 

You might want to check in Tools>Option>Projects and Solutions and check if your option is set to Only Build startup project and dependencies instead of all the solution.

Or instead of using ctrl+shirt+b you should simply press F6 on the project you want to build :)

Daok
+1  A: 

If I understand you right, you might solve this by touching all your project's files. It may be caused by a source-file having a last-modified-time that's in the future.

Edit:

I know that I can solve this specific case, by (e.g.) touching all of the project files, but I'd like to add something to my personal box of tricks that I can use in the future, in the general case.

I'm confused - what's the 'general case' of this problem?

I've updated the original question to make this clearer (hopefully)
Roger Lipscombe
Fixing the title might also help you get relevant answers.
Good point. I'll do that.
Roger Lipscombe
A: 

You can use shift+F6 to build just the current project.

A: 

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.

Kris Erickson
It's a C++ project, the MSBuild verbosity settings don't seem to have any effect.
Roger Lipscombe
Weird, I was pretty sure I had used this in the past to figure out a dependency in C++, but your right, it only works for DotNet languages.
Kris Erickson
A: 

While not directly answering my question: "is there a tool that'll work this out for me?", I found the specific problem by using SysInternals Process Monitor:

The project was configured with /analyze, which requires Visual Studio Team Edition, but the version on this PC is Visual Studio Professional, which doesn't support it. Unfortunately, there appears to be a bug in Visual Studio, where it thinks that the .pchast file should be created, even though it has no way to do so. I've raised this on Connect.

I think I might write a macro for Visual Studio Professional that, if /analyze is turned on, simply creates an empty .pchast file at the end of the build...

Roger Lipscombe