C# – Visual Studio Builds Projects Every Time I Run

cnetvisual studiovisual studio 2010

I have a .NET solution in Visual Studio 2010 with a bunch of projects. Up until recently, when I would run the startup project from within the IDE, projects would only build if changes had been made to the code in either the startup project or one of the dependency projects.

About two weeks ago I noticed that every time I run the startup project, Visual Studio builds all projects, which takes about seven minutes. Needless to say this is taking a large amount of time out of my day, and I've tried my best to look online for solutions, but have yet to find any solutions that address my specific problem.

A few additional pieces of information – the same problem began happening to everyone else on my team around the same time that I began experiencing this issue.

We are also using a source code repository. Since we didn't change any settings in Visual Studio, my suspicion is that someone inadvertently changed something in the source code for some project that now requires all projects to build every time.

Any suggestions would be greatly appreciated.

Best Answer

The cause could be many things, so without having your solution + projects, we can only guess.

The typical way I handle this problem is by narrowing it down with a binary search. That is,

  1. I build everything.
  2. Next I find something in the middle of the build order and build that project. If something that that project depends on is the culprit, you'll experience the issue. If something that it doesn't depend on has the problem you won't (i.e. it will say all projects skipped).
  3. Now you repeat this process until you narrow it down to (hopefully) the project that has started causing the problem.

This (of course) only works if there is a single project that introduced the new problem (which is likely).

One of the culprits in my specific situation was having an x64 project reference an x86 project that wasn't selected to be built in the x64 configuration.