Why is Visual Studio 2008 always rebuilding my whole project?

前端 未结 18 1808
栀梦
栀梦 2021-02-05 18:22

I have a Visual Studio project with about 60 C++ source files. I can do a build, and it completes without errors. But if I immediately hit F7 again, it always re-compiles about

相关标签:
18条回答
  • 2021-02-05 18:55

    I had something similar. Even though I did have pre and post build events, they weren't causing the issue. It turned out that I had a number of projects down the reference chain that had content files that were marked as "copy always" instead of "copy if newer" meaning that these projects were always considered "out of date". By changing all of these to "copy if newer", changes to my unit test project no longer forced a recompile of all of the other projects.

    0 讨论(0)
  • 2021-02-05 18:56

    Project Properties -> "C/C++" -> "Output Files" -> "Program Database File Name" option should not be empty. Set this option by selecting from drop-down box . The option will be set like this: $(IntDir)\vc90.pdb. And line ProgramDataBaseFileName="" will be removed from vcproj file.

    Then only changed *.cpp files will be recompiled when you build the project or solution.

    0 讨论(0)
  • 2021-02-05 18:59

    We have that here regularly:

    • delete all intermediate and output files by hand. The clean option in vstudio is sometimes not enough. From a fresh start do the complete build. If after a complete build vstudio still wants to recompile certain files it might be related to next bullet.
    • if in your vcxproj a header file is referenced which is not on disk, the project is also recompiled. You might check this by some hidden feature described on MSDN blogs or just touch (i.e. click on it to open) all header files in the project exploder and see if one does not exist on disk
    0 讨论(0)
  • 2021-02-05 19:00

    There is similar issue with project rebuild. Visual Studio does not recompile but re-links a project every time on F7 hit.

    Fix is simple. Try to open in Editor all files included into project (from Solution Explorer double click on each file) and remove from solution those files which do not exist.

    0 讨论(0)
  • 2021-02-05 19:02

    Are any of your file dates in the future? This can occur if you changed time zones or changed the system clock time. Dates in the future will confuse the IDE and force a rebuild every time F7 or F5 is hit.

    0 讨论(0)
  • 2021-02-05 19:04

    In my case I changed system data time to previous date so it is rebuilding every time because of different time stamp of the files once changed to the current time its not rebuilding every time.

    0 讨论(0)
提交回复
热议问题