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.

Baum mit Augen
  • 49,044
  • 25
  • 144
  • 182
user1795223
  • 291
  • 1
  • 3
  • 8
  • 1
    That's a dupe, IIRC. Search SO thoroughly. – Bartek Banachewicz Feb 19 '13 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. – user1795223 Feb 19 '13 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?) – Mooing Duck Feb 19 '13 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. – Mooing Duck Feb 19 '13 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 '13 at 00:28
  • When I copied a project folder from one machine to another and attempted to build and run it in debug mode I kept getting this 'error'. Enabling diagnostic logging revealed that AlwaysCreate was specified, which many others seem to have seen when a header file is missing but my project is so simple, just a header file and a main cpp file so there is no chance of this being the case for me. So maybe one of the external dependencies was missing since this was compiled on a different machine with a (potentially) different download of Visual Studio 2010 Express (workplace is too cheap to pay for p – OOhay May 22 '13 at 15:06
  • Some of these responses aren't valid responses. Particularly the comment, "The project being out-of-date is not an error...". The message you're getting is an error. I'm also getting the same error. I first got the error on VS Express 2013. Since I had access to VS 2013, I uninstalled VS Express and installed VS Ultimate 2013. With a fresh install, I copied a simple, tested program and it produced the same error. It was the first program I ran on a fresh install so it would seem that it's obviously an error related to a VS and/or Windows settings. I'm working on getting an answer from various –  Feb 01 '14 at 19:41

6 Answers6

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.

CrouZ
  • 1,721
  • 17
  • 17
  • 1
    Do you know how to debug with VS2015? – Xiao Jia Oct 03 '16 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 05 '17 at 22:30
  • Added a log message example. – CrouZ Aug 06 '17 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 01 '17 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. – Michael Rodby Feb 01 '18 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.

Community
  • 1
  • 1
Colin Smith
  • 12,375
  • 4
  • 39
  • 47
5

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.

dankos
  • 51
  • 1
  • 1
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.

lucky zhao
  • 61
  • 4
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).

Stephen Edmonds
  • 948
  • 1
  • 9
  • 25
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.

yano
  • 4,827
  • 2
  • 23
  • 35