21

I've been trying to get Visual C++ working, but I'm getting this error when building every project: "This project is out of date" "Would you like to build it?" It fails to build every time.

When I rebuild, the build still fails, although in the logger I don't notice any error messages, which makes me think its not logging properly (I'm using a third party program to log).

I've followed some of the instructions here: http://blogs.msdn.com/b/vsproject/archive/2009/07/21/enable-c-project-system-logging.aspx and enabled logging.

I'm getting this error: project not up to date because "insert file name here".lastbuildstate is missing. Note that in actual visual studio, there is nothing logged. I was unable to find anything on this in google. It may be that I incorrectly enabled logging, but I feel that this is the error.

7
  • 1
    That's a dupe, IIRC. Search SO thoroughly. Feb 19, 2013 at 22:51
  • I have looked for 3 hours, I cannot find anything to help with this. If you have found something that can help, please direct me to it. Feb 19, 2013 at 22:56
  • If you open visual studio and try to compile your project/solution manually, do any errors appear there? (Is this a problem with the logging or your code?) Feb 19, 2013 at 23:12
  • 1
    Also, keep in mind, The project is out-of-date probably because it's never successfully built, and that the reason it's failing to build has nothing to do with lastbuildstate nor your logging. The project being out-of-date is not an error, merely a point of interest. You can disable that diolog in the visual studio options, but it won't make your project magically compile, nor fix your logging issues. Feb 19, 2013 at 23:15
  • This can also be caused by having files in your solution that no longer exist on disk, thus datetime stamp check fails and always thinks its out of date
    – Lodle
    Feb 20, 2013 at 0:28

6 Answers 6

31

You should let Visual Studio tell you why it needs to rebuild. Visual Studio 2015 has built in support for this:

  • Tools (menu)
  • Options
  • Project and Solution
  • Build and Run

Change MSBuild project build output verbosity to Detailed or Diagnostics.

In my case it printed a message like this:

1>------ Up-To-Date check: Project: xyz, Configuration: xyz ------
1>Project not up to date because build input 'C:\ws\Missing.h' is missing.

... and removing that header from the project fixed the problem.

To get this information in older Visual Studio versions, you need to use DebugView and modify devenv.exe.config (see Colin Smith's answer: https://stackoverflow.com/a/21759835/1941779). Note that this solution does NOT work for Visual Studio 2015.

5
  • 1
    Do you know how to debug with VS2015?
    – Xiao Jia
    Oct 3, 2016 at 11:23
  • 3
    this answer misses the point: how to figure out from that giant log what made VS think that project is out of date. What to look for in that detailed log, what words or phrases?.. that's the point.
    – Pavel P
    Jul 5, 2017 at 22:30
  • Added a log message example.
    – CrouZ
    Aug 6, 2017 at 21:40
  • 1
    You might need to repeat this more than once. I had 2 bitmap resources that had been deleted but were still listed as part of the project. The first build log listed one of them, after fixing that and building twice I got the log message for bitmap 2.
    – Dave S
    Nov 1, 2017 at 23:55
  • 1
    When I tried this, the log file was huge, and I spent some time scrolling up through the output looking for relevant messages. It turned out that the "Up-To-Date check" was right at the top of the log, which in hindsight is reasonable, since that's the first thing it does. Like @CrouZ, this pointed to a header that had been deleted from my hard drive but not removed from the project file. Feb 1, 2018 at 22:35
28

What are "tlog" files?

"tlog" files are created by the "Tracker.exe" process which runs while you do a build, and records some information about the build.

That information is used and updated the next time you start a build to help detect "out of date" files, and thus enable the build system to only build the bits that need to be rebuilt (rather than building everything again).

What causes the "out of date" problem?

The problem can be caused by incorrect or stale information in the *.tlog files.

There are 3 main ways that can happen:

1) You built a project on your hard disk, and then moved the directory to another location...the "tlog" files recorded the paths of the old location, yet because you moved the files, they are no longer there, thus you get "out of date".

2) Your "Project" has references to files (usually header files), which do not exist at the location specified. This might occur if you deleted a file from your source control system, but forgot to remove it from your project, or because you refer to header files of a library which might be "installed"/present at a different location. Often, Developers assume files are located at the same "place" on everyones machine....not always the case!

3) You have done some "refactoring" of your project, and moved files around to different subdirectories, or even renamed them - so the paths/names of the files recorded in the "tlog" do not match what exists on your disk i.e. stale.

What is the way to fix it?

Doing a "Clean+Build" or "Rebuild" does not always fix it...as those operations do not delete the "tlog" files. So:

  • delete any "tlog" files that you can find in your solution/project directories and rebuild.

  • make sure your Project does not refer to non-existent files

How do I work out which files are non-existent?

If you want to know/find out exactly which files Visual Studio is thinking are out of date, then you can turn on some diagnostic information in Visual Studio....and watch the messages in DebugView...showing the full path of the files it is probing.

In devenv.exe.config you put:

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

More Details

Lets say you created a Solution and a set of Projects in a particular directory e.g. S:\MYPROJECTS, and you compile and run/debug it, etc.

You then decide to move that whole directory to somewhere else on your drive, or you re-factor your Projects e.g. change their directory names, etc.

Now when you do a "Start Debugging/F5", Visual Studio does the depending checking, and thinks you have "out of date files".

Even if you do a "Clean Solution", or a "Rebuild Solution"....you still get the "out of date files" message.

See here:

The problem is caused by the ".tlog" files which are being consulted during the dependency checks...when you moved the solutions/projects (along with a builds intermediate files) they cause confusion to the Visual Studio builder.

The solution is to delete all the .tlog files.....they will then be re-generated the next time you do a build...and from that point on you won't get a bogus "out of date files" message....unless they truly are out of date.

6

I too kept getting "The project out-of-date" error, even though there were no changes. I traced it to a header file listed in Solution Explorer that was no longer being used and had been deleted from the project's directory. Removing it from the SE list fixed the extraneous error message from popping up.

1
  • I'm glad you added this (10 years ago). Just went through my project and this was the issue.
    – El Ronaldo
    Apr 12 at 22:00
4

I had this problem, too. In my case the reason was the references to files (usually header files), which do not exist at the location specified.

1

I ran into this problem and, using the diagnostics trick that colinsmith posted about, was able to trace the problem back to the fact that my .vcxproj was referencing a file that didn't actually exist anywhere (It had been deleted a long time ago, but never removed from the project file).

0

Just for posterity, I was getting this problem, and then realized my computer clock had somehow jumped approximately 48 hours into the past. After I set it back to current time, the warning went away.

Not the answer you're looking for? Browse other questions tagged or ask your own question.