Visual Studio keeps building everything
Asked Answered
O

6

6

I have a large .sln file with many projects.

I just made a change in project A and it builds nine other projects that project A references, but that had no code change.

Is there a trick to speed this process up?

Oldworld answered 7/6, 2010 at 18:9 Comment(1)
The way you state this it clearly seems to be a bug. If A changes, projects A depends on should not rebuild, only projects which depend on A. In previous versions of VS, I have seen this happening when custom-build steps were involved.Aeneid
P
2

Divide and conquer: Limit the amount of build time that goes on in your solution by creating additional solutions that contain logical subsets of projects you're working on. This limits your scope and will speed up builds.

See the The Partitioned Single Solution Model in this MSDN article: http://msdn.microsoft.com/en-us/library/ee817674.aspx

Key quote from the article:

Separate solution files allow you to work on smaller subsystems within your overall system 
but retain the key benefits of project references. Within each subsolution file, 
project references are used between constituent projects.
Pustulate answered 7/6, 2010 at 18:16 Comment(2)
So, this method would have you create a solution with one project (Project A in this example) that simply references the DLLs from all the other projects instead of all the other projects? So when you build you only recompile one project.Jahdai
Not necessarily just one project but possibly.Pustulate
C
2

This happens when a project has a file that doesn't really exist.
The project can't determine if the file was changed (because it's not there) so it rebuilds.

Simply look at all the files in the project, and search for the one that doesn't have an expandable arrow near it.

Chickabiddy answered 28/4, 2014 at 12:9 Comment(1)
Expandable arrow? Isn't that only for GUI classes (e.g. Windows Forms) and similar compound stuff? In one of my projects/solutions, I have lots of .cs files (that all exist) that have stand-alone simple classes in them, and they don't have an arrow.Dorsy
E
1

Selecting 'build only' when right-clicking the project A should do the trick. I am not sure if there is a way to keep it from building referenced projects as well when building the solution (which is what the standard 'build' command does).

Eda answered 7/6, 2010 at 18:13 Comment(0)
C
1

Change the build output verbosity to detailed and see what it says at the top. In my case, it told me the project wasn't up to date because of a file that was missing.

Cyzicus answered 26/7, 2016 at 8:49 Comment(2)
How do you change the build output verbosity to detailed?Dorsy
One way may be to set menu ToolsOptionsProjects and SolutionsBuild and RunMSBuild project build output verbosity to "Diagnostic".Dorsy
R
0

Make sure your project dependencies are correct. Right click on the project and go to "Project Dependencies." Make sure that each project only depends on the minimal set of other projects that are needed to link.

Regeneracy answered 7/6, 2010 at 18:13 Comment(0)
C
0

Another thing to look for, because it just happened to me, is that if you synchronise your view using ClearCase while your solution is open and some of your code was updated by the synch, it sometimes sets the timestamps incorrectly on the files, so it keeps thinking your source files have been modified and compiling your project every time.

To fix this I had to close the solution and reopen it again, and it behaved as expected.

Corvus answered 30/3, 2012 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.