Monday, March 30, 2015

Visual Studio rebuilds all projects instead of just the projects referenced by the current project

One of our Visual Studio solutions all of sudden started building all projects in the solution, even when I was trying to build one single project.

I found that Visual Studio allows you to set a flag in the registry that allows you to see more information regarding why it thinks a project is out of date and is trying to build it. The setting is called: U2DCheckVerbosity, which I believe stands for “Up to Date Check” verbosity level. By setting it to a value of 1, you get information in the output window that specifies why VS believes a project is not up to date and is causing it to build.

You can either create the new key manually, or copy the following text into notepad and save it as a REG file and run it.

Windows Registry Editor Version 5.00


Once thats done, if you look in the output window, you will see messages like:

Project ‘xxxxxx’ is not up to date. Project item ‘some_file_path\log4net.config' has 'Copy to Output Directory' attribute set to 'Copy always'.

I had not realized that “Copy Always” would cause a project to consider itself dirty and had gone through and set it on some config files I had recently added. So it turned out, it was I that was at fault. Fixed the config issue and everything is good now.