locked
Visual Studio Add-In: Build project or skipped or Up-To-Date RRS feed

  • Question

  • I'm building a simple Visual Studio add-in (for in-house purposes) that will monitor the time it takes to build a solution and log this.

    I have it almost where I want it, except for one small issue.

    The logging doesn't take into account projects that were "up-to-date" or "skipped"

    I'm not too fussed about the skipped part, but I would like to determine if a project is classed "up-to-date" or not. How can I determine this?

    My current code hooks into the BuildEvents of the DTE2 object for both the solution and each project, although the OnBuildProjConfigBegin / OnBuildProjConfigDone events only pass through if there were successful or not.

    Is there a way to find out if a project is up-to-date during a build event in c#?

    Wednesday, June 7, 2017 11:40 AM

All replies

  • I'm building a simple Visual Studio add-in (for in-house purposes) that will monitor the time it takes to build a solution and log this.

    I have it almost where I want it, except for one small issue.

    The logging doesn't take into account projects that were "up-to-date" or "skipped"

    I'm not too fussed about the skipped part, but I would like to determine if a project is classed "up-to-date" or not. How can I determine this?

    My current code hooks into the BuildEvents of the DTE2 object for both the solution and each project, although the OnBuildProjConfigBegin / OnBuildProjConfigDone events only pass through if there were successful or not.

    Is there a way to find out if a project is up-to-date during a build event in c#?

    Tuesday, June 6, 2017 11:45 AM
  • Hi Mordehaid,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the VS Integrate development. Since our forum is to discuss the VS IDE, I will help you move this thread to this appropriate forum: Visual Studio Development  >  Visual Studio Integrate to seek for a more professional support, thank you for your understanding.

    Best regards,

    Sara


    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.

    Wednesday, June 7, 2017 2:09 AM
  • Hi Mordehaid,

    >>Is there a way to find out if a project is up-to-date during a build event in c#?

    From the following link, we know that:

    A target element can have both an Inputs attribute, which indicates  what items the target > expects as input, and an Outputs attribute,  which indicates what items it produces as output  MSBuild attempts to find a 1-to-1 mapping  between the values of these attributes. If a 1-to-1 mapping exists,  MSBuild compares the time stamp of every input item to the time stamp  of its corresponding output item. Output files that have no 1-to-1  mapping are compared to all input files. An item is considered  up-to-date if its output file is the same age or older than its input  file or files.

    If all output items are up-to-date, MSBuild skips the target. This  incremental build of the target can significantly improve the build  speed. If only some files are up-to-date, MSBuild executes the target  but skips the up-to-date items, and thereby brings all items  up-to-date. This is known as a partial incremental build.

    https://msdn.microsoft.com/en-us/library/ee264087.aspx

    And We could also disable up-to-date via the following property in csproj file.

    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>

    If we want to find out related information, we need to check the property in proj file and compares the time stamp of every input item to the time stamp  of its corresponding output item. Output files that have no 1-to-1  mapping are compared to all input files.

    Best regards,

    Cole Wu


    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.

    Wednesday, June 7, 2017 8:33 AM