Visual Studio 2010 always thinks project is out of date, but nothing has changed

Chris U picture Chris U · May 4, 2010 · Viewed 136.3k times · Source

I have a very similar problem as described here.

I also upgraded a mixed solution of C++/CLI and C# projects from Visual Studio 2008 to Visual Studio 2010. And now in Visual Studio 2010 one C++/CLI project always runs out of date.

Even if it has been compiled and linked just before and F5 is hit, the messagebox "The project is out of date. Would you like to build it?" appears. This is very annoying because the DLL file is very low-tiered and forces almost all projects of the solution to rebuild.

My pdb settings are set to the default value (suggested solution of this problem).

Is it possible the get the reason why Visual Studio 2010 forces a rebuild or thinks a project is up to date?

Any other ideas why Visual Studio 2010 behaves like that?

Answer

Mosc picture Mosc · Apr 22, 2011

For Visual Studio/Express 2010 only. See other (easier) answers for VS2012, VS2013, etc

To find the missing file(s), use info from the article Enable C++ project system logging to enable debug logging in Visual Studio and let it just tell you what's causing the rebuild:

  1. Open the devenv.exe.config file (found in %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\ or in %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\). For Express versions the config file is named V*Express.exe.config.
  2. Add the following after the </configSections> line:

    <system.diagnostics>
      <switches>
        <add name="CPS" value="4" />
      </switches>
    </system.diagnostics>
    
  3. Restart Visual Studio
  4. Open up DbgView and make sure it's capturing debug output
  5. Try to debug (hit F5 in Visual Studio)
  6. Search the debug log for any lines of the form:

    devenv.exe Information: 0 : Project 'Bla\Bla\Dummy.vcxproj' not up to date because build input 'Bla\Bla\SomeFile.h' is missing.

    (I just hit Ctrl+F and searched for not up to date) These will be the references causing the project to be perpetually "out of date".

To correct this, either remove any references to the missing files from your project, or update the references to indicate their actual locations.

Note: If using 2012 or later then the snippet should be:

<system.diagnostics>
  <switches>
   <add name="CPS" value="Verbose" />
  </switches>
</system.diagnostics>