Visual Studio keeps asking to rebuild project
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Visual Studio keeps asking to rebuild project

  1. #1
    Join Date
    Dec 2006
    Posts
    60

    Visual Studio keeps asking to rebuild project

    I recently switched to VS2010 from VS 6.0. I've converted my project and compiled successfully. But everytime I run the program from VS (ie by click "Start Debugging" or "Start without Debugging"), VS reports that the project is out of date and asks to build it, even though I had just finished building it. This occurs in both Debug and Release configurations.

    Here is the output window if it helps:
    Code:
    1>------ Build started: Project: ConfigTool, Configuration: Release Win32 ------
    1>Build started 5/4/2011 6:30:59 PM.
    1>InitializeBuildStatus:
    1>  Creating ".\Release\ConfigTool.unsuccessfulbuild" because "AlwaysCreate" was specified.
    1>ClCompile:
    1>  All outputs are up-to-date.
    1>  All outputs are up-to-date.
    1>ResourceCompile:
    1>  All outputs are up-to-date.
    1>Link:
    1>  All outputs are up-to-date.
    1>  ConfigTool.vcxproj -> C:\Visual Studio 2010\Projects\ConfigTool\.\Release\ConfigTool.exe
    1>Manifest:
    1>  All outputs are up-to-date.
    1>FinalizeBuildStatus:
    1>  Deleting file ".\Release\ConfigTool.unsuccessfulbuild".
    1>  Touching ".\Release\ConfigTool.lastbuildstate".
    1>
    1>Build succeeded.
    1>
    1>Time Elapsed 00:00:00.07
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

  2. #2
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Visual Studio keeps asking to rebuild project

    Hi,

    I've only seen this if any files were saved "in the future", e.g. if your PC date was set incorrectly at some stage and you saved a file.

    Alan

  3. #3
    John E is online now Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,429

    Re: Visual Studio keeps asking to rebuild project

    I have this problem quite often in VS2005 and I've found that the solution is to compile any changed files (CTRL+F7) and then - only after all changed files are compiled - select 'Build'. If I perform the compile and link in one operation (selecting 'Build' straight away or just pressing F7) I almost always get this problem.

    If that doesn't fix it, the most likely explanation is that you've got one or more source files depending on a header file with a more recent date. Whenever I modify a header file I routinely set its date to some date that's a long time in the past, just to avoid this. Of course, you do end up having to do a full Rebuild (once) but that's a lot better than seeing this problem all the time.

    Try to make sure that all your header files are dated a long time ago.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  4. #4
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Visual Studio keeps asking to rebuild project

    What is your “MSBuild project build output verbosity”?
    It is in Tools->Options->Projects and Solutions->Build and Run.
    Try setting it to Detailed and see if you get more info.
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  5. #5
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Visual Studio keeps asking to rebuild project

    This has happened on every single install of VS2010 I've ever seen. I think it's a bug in the IDE. Just say "Don't ask again" and ignore it----the extra time used is minimal.

  6. #6
    Join Date
    Dec 2006
    Posts
    60

    Re: Visual Studio keeps asking to rebuild project

    @John E:
    Separating the compile and build step didn't fix the problem. It would still ask to rebuild.
    I don't know how to set the modify date of a file as you mention, but I made sure all source files are more recent than header files. No luck with this either.


    @VladimirF:
    Here is the detailed output. I can't make sense of all of it, but maybe someone here can.
    See attached txt file, the forum won't let me post such a long text.

    @Lindley:
    So this is a known bug?
    I don't want to disable the rebuild check because there are occasions when this feature comes in handy, like when I forget to build after making a change.

    I created a new test project entirely in VS2010 (instead of converting an old project). I do not get the same issue. After building once, it does not ask again when I run the program. So it must have to do with the conversion from old project...
    Attached Files Attached Files

  7. #7
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: Visual Studio keeps asking to rebuild project

    Quote Originally Posted by acerunner316 View Post
    I created a new test project entirely in VS2010 (instead of converting an old project). I do not get the same issue. After building once, it does not ask again when I run the program. So it must have to do with the conversion from old project...
    Did you specify something under the 'custom build step' in the project settings? I've seen that cause such behavior. Moving the task from the custom build step to the post build solved it.

    Otherwise, check the differences between both project files. They are just text files, so you can easily compare them.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  8. #8
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Visual Studio keeps asking to rebuild project

    Quote Originally Posted by acerunner316 View Post
    @Lindley:
    So this is a known bug?
    Known to me, anyway. It's always possible both of us are doing the same thing wrong.

  9. #9
    John E is online now Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,429

    Re: Visual Studio keeps asking to rebuild project

    Quote Originally Posted by acerunner316 View Post
    I created a new test project entirely in VS2010 (instead of converting an old project). I do not get the same issue. After building once, it does not ask again when I run the program. So it must have to do with the conversion from old project...
    That's an interesting insight. Now you mention it, all my existing VS2005 projects were converted from VC++6 and I often do get the same problem. Those fixes I mentioned work very reliably for me though.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  10. #10
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Visual Studio keeps asking to rebuild project

    In VS2010, this problem is typically casued by a header file that has been physically deleted, but, not removed from the project. You can determine what header it is by enabling Project System Logging. It's not a good idea to use the build flag to turn off the out-of-date warning since it may be a legitimate problem with the build.
    Gort...Klaatu, Barada Nikto!

  11. #11
    Join Date
    Jun 2002
    Location
    Bozeman, MT
    Posts
    8

    Re: Visual Studio keeps asking to rebuild project

    Mike Harnad's might be on to something.

    i tried a full rebuild - even manually deleted the .suo, .sdf, and any other files that aren't required. nothing worked.

    Mike suggested that a header could be missing but still in the project. I went through all the files that were in my project and double clicked them - thinking that if one had been deleted it wouldn't open. One of the header files popped up an error message - something about the text viewer not being able to be opened (in all my programming years i've never seen that window and unfortunately i didn't write down the exact message).

    anyway, i removed that header file from my project (the project uses it, but it was an inline header). performed a rebuild all - and bam! fixed!

    i think maybe the project entry for that header had somehow been corrupted.

  12. #12
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,646

    Re: Visual Studio keeps asking to rebuild project

    I happened to be haunted by a quite similar problem during the last days, so this bubbled-up thread came in really handy to me.

    In my case it wasn't a future-timestamped file that caused the problem, but a bunch of files with creation dates after their modification dates. This can happen quite easily when copying files between projects, or, much worse, when scraping the entire project and restoring it from a backup. Resetting the creation date to the modification date fixed the issue. (The debug configuration needed a clean-up run before this became effective while the release config didn't, for unknown reasons, but then again, hey, it works! ) The opposite manipulation probably would help as well, but would trigger a lot of unnecessary rebuilds, though only once.

    Interestingly, the app.ico file put into any (non-console) project by the IDE by default, always suffers from the same defect without any adverse effect, but perhaps they simply hacked away the sensitivity to this quirk for this particular file...

    Hope this will help someone who reads it later...
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  13. #13
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Visual Studio keeps asking to rebuild project

    If this is VS2010, then this can be caused by a de-syncing of what the ID knows, and what the build system (i.e. MSBuild) has to work off.

    Try if a REBUILD solves the problem.

  14. #14
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Visual Studio keeps asking to rebuild project

    It can also happen if one of the files has a custom build step which has an "output" defined, but the custom build step does not actually create this outputfile. from your build log, that doesn't seem to be the case here though.

  15. #15
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Visual Studio keeps asking to rebuild project

    All,

    There's no reason to guess at the cause. If you follow the link in my prior response and implement the IDE configuration tweak it speaks of, you'll know what the exact cause is.
    Gort...Klaatu, Barada Nikto!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


HTML5 Development Center