开发者

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:

  • discovered a warning in verbose build mode described here: http://support.microsoft.com/kb/2516078 It doesn't seem to be related though. I'm still going to fix this just-in-case. (NOW FIXED by re-referencing projects + path hints by hand using $(VAR) environment variables)

  • pointed a desk fan directly at laptop. CPU was being throttled because of overheating.

  • went through every project and switched off auto serialization (found in the project properties / build screen)

  • increased the maximum number of parallel builds in tools / options / Build and Run. I didn't think this would help given that it is just a laptop with two cores, but it did.

  • seeing 'Previously built successfully'... so looks like desired behaviour is often occuring (still investigating). Situation is much better now though.

  • still开发者_开发问答 going through verbose build logs and tidying things up.


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.

Strange VS2010 build glitch occurs in my solution


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜