Solving the Visual Studio 2010 AlwaysCreate rebuild issue

I had the same problem on both converted and from-scratch projects. I got a hint from a MS page about missing files. I checked my project and found that it referenced a file that did not exist. Replaced it with the correct file, and the problem went away.


I've had this problem many times and it was always frustrating. I'll tell you what the problem was in my case, but first I have to ask you:

  • Did you do a rebuild-all before you tried running the first time, or just a rebuild?
  • Once you do a rebuild all, does it ask you yet again to rebuild if you've made no changes?

The problem in my case was somewhat complex. I had custom build rules that copies binaries for Stingray from their source directory (where they lived) to a directory in my build tree. The binaries were marked as a dependancy, so that they were copied before each build in case they changed.

The dependancy checked looked at the timestamps of these files to see when they were changed. If the blah.lib had a mod date of last December in it's source directory, then when it was copied it would have the same mod date. The dependancy checked would note that "hey this file's pretty old, we have to rebuild it," and then it would ask if I wanted to do a full rebuild.

For a while I got by by just saying "No," but eventually I fixed the problem by changing the custom build rule to write a new text file after it did the file copy. That would make the new text file the dependancy, and not the blah.lib file, and it made the compiler happy.


  1. See in output window what file is rebuild

  2. Go to menu Tools->Options, then navigate to Project and Solutions->Build and Run. Change option MSBuild Project build output verbosity to:

    Diagnostic
    
  3. Build, got long log

  4. Find file (from 1) in log, read diagnostic. You may found for example header name which has date in future or absent.