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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Xander
  • 9,069
  • 14
  • 70
  • 129
  • 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. – sbi Jun 07 '10 at 18:21

6 Answers6

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.

Yochai Timmer
  • 48,127
  • 24
  • 147
  • 185
  • 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. – Peter Mortensen Dec 10 '17 at 17:29
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.
Paul Sasik
  • 79,492
  • 20
  • 149
  • 189
  • 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. – wcm Jun 07 '10 at 18:41
  • Not necessarily just one project but possibly. – Paul Sasik Jun 07 '10 at 19:58
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).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
stijn
  • 34,664
  • 13
  • 111
  • 163
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.

Cleroth
  • 144
  • 1
  • 11
  • How do you change the build output verbosity to detailed? – Peter Mortensen Dec 10 '17 at 17:32
  • 1
    One way may be to [set menu *Tools* → *Options* → *Projects and Solutions* → *Build and Run* → *MSBuild project build output verbosity* to ***"Diagnostic"***](https://stackoverflow.com/questions/1211841/how-can-i-make-visual-studios-build-be-very-verbose/1211886#1211886). – Peter Mortensen Dec 10 '17 at 19:09
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.

bshields
  • 3,563
  • 16
  • 16
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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
EdChum
  • 376,765
  • 198
  • 813
  • 562