none
Lot of Unnecessary Visual Studio Rebuilds - Tracking Log problem? RRS feed

  • Question

  • Hi - I'm getting an awful lot of unnecessary Visual Studio (2017) rebuilds.  Mine is a big Visual C++ project and all these builds are hitting my productivity badly so all help much appreciated.

    I can't detect a pattern to the problem.  My perception is that sometimes it rebuilds practically every file when I've just changed one .cpp file.  Sometimes after a full build, if I hit build again, it will rebuild loads more files.  But sometimes it doesn't rebuild anything because it recognises that everything is up-to-date.

    When this happened yet again just now (loads of files being rebuilt for no reason that I could see), I stopped the build and clicked on Tools -> Options. I chose Projects and Solutions -> Build and Run and selected Diagnostic in “MSbuild project build log file verbosity”.  I then restarted the build, waited a while, and checked the log file.  It had more than 10 pages filled with lines like this:

                         <source file>.cpp will be compiled because it was not found in the tracking log. (TaskId:28)


    Anyone got any suggestions what the problem could be?


    Simon

    Wednesday, August 14, 2019 3:00 PM

All replies

  • Hi simon22.

    Welcome to the MSDN forum.

    As far as l know, the build option will only compile the changed file or the whole project not yet built. You can follow these steps to have a try:

     ###open Tools->Options->Projects and Solutions->Build and Run->set "On Run, when projects are out of date" to "Never build"

    If this does not work, the problem seems to be your project organization and file.The issue may happen:

        1.  The current project references other projects and therefore generates dependencies. When the project is compiled, it will be compiled along with the related projects

        2.  If you have a lot of images ,text information and any other resource files in your project, and you select "copy always" will lead this issue.

    So please check your project and if these solutions presence, do something to deal with them.

    More information and solutions you can refer to this:

    https://stackoverflow.com/questions/14916729/visual-studio-rebuilds-unmodified-projects

    Any feedback will be expected.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, August 15, 2019 9:32 AM
  • Hi Perry

    thanks for the reply.  You suggested that I do this:

    >> ###open Tools->Options->Projects and Solutions->Build and Run->set "On Run, when projects are out of date" to "Never build"

    Why would I want to do that?  I don't want to stop rebuilds?  I just want to stop unnecessary rebuilds.

    You said

    >> 2.  If you have a lot of images ,text information and any other resource files in your project, and you select "copy always" will lead this issue.

    Where is this "copy always" option?

    >> 1, The current project references other projects and therefore generates dependencies. When the project is compiled, it will be compiled along with the related projects

    My solution only contains one project. 

    My question is - what could explain why I get the message:

    <source file>.cpp will be compiled because it was not found in the tracking log.

    That has nothing to do with dependencies surely?

    As an experiment, I just tried changing a header file to see what message you get when you chance a dependency.  The log file has numerous lines like this:

    <source file>.cpp will be compiled because <header file>.H was modified at 15/08/19 15:55:46. (TaskId:28)

    Surely if the problem was to do with dependencies, I would see a line like that?  What could explain the messages I have been getting about"... will not be compiled because it was not found int the tracking log"?


    Simon

    Thursday, August 15, 2019 3:18 PM
  • Hi simon22,

    Thanks for your feedback.

    According to your description, we suggest you can create a small project to verify whether your problem still exists.

    • If your issue still persists, you can share the small demo with us.

          Also,try to update your VS to the latest version to check whether the issue exists.

    • If the issue does not persist, that is your project problem and you should check the relationship between files and the project configuration information.

    Any feedback will be expected.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com





    Friday, August 16, 2019 8:46 AM
  • Hi simon22,

    Did your issue solved? Did you try my steps to test it? If your issue still exists, please feel free to let us know. 

    Thanks for your understanding.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, August 19, 2019 5:43 AM
  • Hi Perry - thanks for the reply.

    >> According to your description, we suggest you can create a small project to verify whether your problem still exists.

    How do you suggest I do that?  This project has been in development for a very long time and it's very big.  I have no idea what is causing the build problem and I can't even detect a pattern in when it happens.  So how am I supposed to create a small project which exemplifies the problem?

    >> If the issue does not persist, that is your project problem and you should check the relationship between files and the project configuration information.

    Really?  If I create a small project which doesn't have the problem that will show that it is a problem with my project?  Meaning that it's not an MS Build problem?  How do you conclude that?  Just because it is possible to build a project in which the problem is not manifested does not mean that we have excluded the possibility that there is a bug in your code of some kind.

    I was hoping that someone could give me some tips on how I can use the log file to try to find out what is going on.  For example, take the message "source file>.cpp will be compiled because it was not found in the tracking log."  Does this message indicate that something is going wrong, or is this a normal message?  If it's not a normal message, how can I find out why it is occurring.  If it is a normal message which doesn't indicate that something is going wrong, how can I use the information in the log to work out what is happening and what I need to do (e.g. in terms of changing dependencies where possible) to ensure that I get fewer builds in the future?


    Simon

    Tuesday, August 20, 2019 4:33 PM
  • Hi simon22,

    Thanks for your feedback.

    Creating a small demo in your current VS IDE like .net framework console application or any other projects. You would better create more forms in your project then you can change one of the forms to check whether it will loads all the files.The purpose of this is mainly to leave the project to check if it is a problem with the msbuild tool.

    The track

    Also, if your visual studio 2017 is not the newest version, please try to update it.

    BTW, l have found a similar issue which l think could help you.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com



    Thursday, August 22, 2019 10:24 AM
  • Hi Perry - I looked at your link and it didn't seem relevant.    The problem in that case was that an inaccessible folder had been created using git running under bash_on_windows subsystem.   None of that is relevant to me.

    I have built numerous other small applications which do not exhibit this problem.  I cannot build a small demo to illustrate it.  Yes I can easily build a small demo app.  What I can't do is make it exhibit the same problem.

    Can you at least tell which is the tracking log file?  That way, if I can look in that file, I can see if, when it says that a source file "was not found in the tracking log", if this is true or not.

    Also, can anyone suggest a tool that would allow me to easily see which files have the most dependencies.  As far as I can see, there appear to be two issues:

    (1) I sometimes get these warning messages in the build log about "<source file> will be compiled because it was not found in the tracking log".  I would really like to get to the bottom of what's causing this.  Incidentally these lines are followed (always? sometimes?) by a line in the build log that looks like this: "No output for <source file>|<source file>|<source file>|... etc."   Is that relevant.  What's that about?

    (2) I think I have too many dependencies to header files in my code, so one small change is triggering an avalanche of changes.  If I could easily inspect the dependency tree, I could take steps to reduce these.  I don't think this is the only problem but I'm sure it's part of it.

    All help much appreciated.  The problem is as bad as ever.


    Simon

    Friday, August 23, 2019 11:33 AM