Why is Visual Studio always rebuilding some projects?

By , last updated October 8, 2016

Visual Studio or VS is my weapon of choice.

But sometimes, it’s stupidity can’t be expressed with words…

The problem

Sometimes, Visual Studio will always rebuild projects, even though they have recently been built and there are no changes. If you build, and then run you’ll the project will build. If you haven’t disabled the “projects out of date”-dialog, it will pop up and ask you to rebuild.

Within VS, it will match a set of rules to figure out if a project is up to date or not.

Here is how to find out what rules are causing a project to always build.

This applies to both C# and C++ projects.

How to identify the problem.

The simplest way to discover this problem, and probably the most annoying about this is this popup box when running the project (unless you’ve disabled this dialog).

Project out of date popup Visual Studio

Another clue is output text. Regardless how many times you build the project, it’s never up to date.

1>------ Build started: Project: always-build, Configuration: Debug Win32 ------
1>  always-build.vcxproj -> R:code-samplesvisual-studio-always-buildingDebugalways-build.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

The first dialog will only show when “prompt to build” is selected.

Build and run options visual studio

How to fix the problem.

Open devenv.exe.config as Administrator. Default path for VS2013 is C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEdevenv.exe.config.

Add this section to the configuration file.

    <add name="CPS" value="Verbose" />

About here:

denenv exe config visual studio

Restart VisualStudio.

Download and run DebugView from Microsoft (https://technet.microsoft.com/en-us/library/bb896647.aspx).

Build the project.

In DebugView, you’ll see many lines of diagnostics information. One line in particular is the interesting one, that’s the line with not up to date because. If you can’t find that line, select the top line and hit Ctrl-F to open the search dialog, and search for not up.

debugview diagnostics lines

In this case, it’s because it’s missing a file referenced in the solution, [9300] Project 'R:code-samplesvisual-studio-always-buildingalways-build.vcxproj' not up to date because build input 'R:CODE-SAMPLESVISUAL-STUDIO-ALWAYS-BUILDINGNON-EXISTING-HEADER.HPP' is missing.

Remove that file from the solution, and try to rebuild.

Read also  std::list::remove_if predicate

When you get this text from the output window, you’re successful.

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

Just don’t forget to revert / delete the diagnostics settings in devenv.exe.config

The project and code from this post is available at GitHub.


  1. Paul Stanton August 27, 2015 Leave a Reply

    Putting in the change to devenv.exe.config caused Visual Studio 2010 to work correctly for me… So the diagnostic fixes the issue so I can’t figure out where it comes from… Oh well.

  2. Shane Gannon February 17, 2016 Leave a Reply

    Useful tip but after correcting 20 problems with missing files and incorrect outputs I’ve not improved the build speed. At this point I’d like to apply the same CPS verbose setting to msbuild (which is what out build servers use).

    But I’m having a hard time finding how I can do this. I tried setting the above in msbuild.exe.config. But I’ve been unable to save the changes. Even when I run my editor as an Administrator I get an access denied error.

    Any suggestions on how I can get this information when running mbuild instead of Visual Studio? Is there a command line option?

    • Ofek July 5, 2016 Leave a Reply

      Tools->Options->Projects and solutions->Build and run ->
      ‘MSBuild project build output verbosity’ = Verbose

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>