sgtz
sgtz

Reputation: 9019

Strange VS2010 build glitch occurs in my solution

I've discovered that it is rare for Visual Studio behave like this. One of the comments was this might be because the projects were upgraded from VS2008.

To get specific. Say there's a dependency beween projects where A depends on B, B depends on C, and C depends on D.

A<--B<--C<--D.

Now say there's an error in A, but B,C,and D compiled correctly.

What happens next for me is that VS will compile all four projects every time I try to compile A.

Command: right-click on project A, select Build.

same behaviour from menu: Build / Build A


Is there a way to ensure that Visual Studio only rebuilds a dependent projects when there are changes in those proejcts? Currently Visual Studio rebuilds all dependencies.

I noticed that the suggestion on the link below was to partition the solution into logical groups (and then reference .dlls directly I suppose). If this is the best way forward, is it to have each project build to a common .\bin folder, and then reference from there?

related question: Visual studio keeps building everything

It'd be awesome if I could keep one big solution file.

UPDATE:

Upvotes: 0

Views: 595

Answers (2)

Igby Largeman
Igby Largeman

Reputation: 16747

I don't know the cause of the glitch. When I press F5, VS only seems to build what needs to be built.

But I have a suggestion: make good use of the "Unload project" function. If your solution contains projects only because you reference them, but those projects themselves don't depend on anything else in your solution, then once they've been built you can unload them.

For example, this is my current situation:

I'm working on the UI for my project. I have a solution just for my UI.

I need to reference some libraries being developed by other team members, but I rarely make any changes to those libraries myself.

So my solution contains about 15 projects, but only 10 of them are mine. The other 5, the libraries I reference, don't need to be loaded unless I need to see or change that code. So I just keep them "unloaded".

Every day or two I "reload" them, get latest changes from source control, rebuild, and then unload them again.

I also unload some of my own projects which I rarely need to change, such as my framework library.

This keeps my solution nimble because when I build the solution, only about half the code is actually built. It also speeds up searches and keeps the Solution Explorer less cluttered.

Upvotes: 1

Dirk Vollmar
Dirk Vollmar

Reputation: 176169

You probably want to check the following option:

[x] Only build startup projects and dependencies on Run

under Tools -> Options -> Projects and Solutions -> Build and Run.

enter image description here

Upvotes: 4

Related Questions