Microsoft Edge

Try Microsoft Edge

A fast and secure browser that's designed for Windows 10 Get started

This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more
Microsoft Microsoft
    • .NET
      • Apps
      • Internet of Things
      • Mixed Reality
      • Microsoft Edge
      • Hardware
      • IT Center
      • What is Azure
      • Products
      • Solutions
      • Pricing
      • Create a free account
      • Visual Studio
      • Visual Studio IDE
      • Visual Studio Team Services
      • Visual Studio Code
      • Xamarin
      • Visual Studio Dev Essentials
      • Subscriptions
      • Office Dev Center
      • Office 365 for IT pros
    • Microsoft Graph
      • Store
      • Cortana
      • Bing
      • Application Insights
      • .NET
      • Microsoft Azure
      • Microsoft Graph
      • Visual Studio
      • Visual Studio Team Services
      • Windows
      • Office
      • All Developer Centers
    • TechNet
    • Microsoft Developer Network
      • Windows IT Center
      • Office 365 for IT Pros
      • All IT TechCenters
      • Microsoft Download Center
      • Microsoft Azure
      • Visual Studio
      • SDKs
      • Windows
      • Office
      • Microsoft Graph
      • MSDN
      • Azure
      • Windows
    • PowerShell scripts
      • Microsoft Azure
      • Visual Studio
      • Visual Studio Team Services
      • Developer tools
      • Office Dev Blog
      • Server & management
      • Windows
      • Developers
      • TechNet
      • Microsoft Tech Community
      • Visual Studio (MSDN) subscriptions
      • Microsoft Cloud Essentials
      • Microsoft Virtual Academy
      • IT Pro Career Center
    • Microsoft Evaluation Center
    • Channel 9
    • No results
    Sign in
    Developer Community Status
    Visual Studio

    Developer Community

    Get help from our community supported forum
    Visual Studio Visual Studio for Mac .NET C++ VSTS TFS
    All Products
    • Visual Studio
    • Visual Studio for Mac
    • .NET
    • C++
    • VSTS
    • TFS
    Report a problem
    • for Visual Studio
    • for Visual Studio for Mac
    • for .NET
    • for C++
    • for VSTS
    • for TFS
    Report an issue in Visual Studio Installer or Visual Studio
    This allows diagnostic information about the program to be included in your report
    1. Installer or Visual Studio
    2. Report a Problem
    3. Type and Submit
    Available on Visual Studio 2017, Installer, and newer releases
    Would you like to know more?
    • Home /
    • TFS /
    avatar image
    4

    Build agent rebuilds projects which haven't had changes to their source

    Reported by Mark Iannucci Nov 01, 2017 at 04:24 PM tfs

    We just upgraded to TFS 2018 RC 2 on prem. We also installed the build agent that it suggests (version 2.120.2).

    We use a branch policy to trigger builds on pull requests, and we have one build agent assigned to a pool for our builds which have big database projects. We did this because we noticed that the build agent is sometimes able to use a previous dacpac for the current build's artifacts if none of the files in the database project changed.

    With the latest release of the agent, we noticed that this behavior changed, and now all of the projects build regardless of if the underlying files changed. Not only has this lengthened our build time, it has also lengthened our release time because we only deploy the database if the dacpac's hashed value changes. If the build agent creates a new dacpac unnecessarily, the hash changes and the release releases it.

    In an effort to return to the previous behavior, we installed the last version of the agent that we were using (version 2.105.7). It is able to communicate with our TFS 2018 environment and it stopped rebuilding stuff unnecessarily, so we have a workaround.

    I've uploaded the build logs from a release on the prior agent and one on the current agent. The one from the current agent should have skipped the builds like the one on the prior agent did.

    21057logs.zip (14.8 kB)
    21202logs.zip (55.2 kB)
    thub.nodes.view.add-new-comment
    Add comment Show 7
    10 |10000 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users
    avatar image Chris Patterson · Nov 07, 2017 at 06:26 PM 1
    Share

    These builds are in two different directories so they are not going to share working folders. Based on these logs I don't see any difference in behavior for the agent, just a different MSBuild log.

    Can you run the builds with the System.Debug variable set to true and upload those logs.

    avatar image Mark Iannucci Chris Patterson · Nov 14, 2017 at 12:47 AM 0
    Share

    Hi Chris, thanks for taking a look at this. The problem I'm having is build to build. So in those logs I'm not expecting the various projects to share the same artifacts (if they did, I'd have a real problem on my hands!). But the behavior we observed with the older agent is that from build to build the second build would not rebuild a project if the particular commit which caused the rebuild did not modify the underlying code in a particular project. It may take me a few more days to get a solid reproduction of this with both agents, but I will definitely upload additional logs with the System.Debug variable set to true so you can get more detail. Thanks again for taking a look!

    avatar image Mark Iannucci Chris Patterson · Nov 21, 2017 at 01:32 AM 0
    Share

    Hi @Chris Patterson, I've attached 4 build logs.

    This first file is from the older version of the agent, 21057-logs-6780-files-in-project-changed.zip, the files in the project subdirectory changed, and the build built the project appropriately. In the following build, 21057-logs-6781-files-in-project-no-change.zip , some files outside of the project subdirectory changed, and the older version of the agent did not build the project.

    ... I hit the attachment limit. Will hopefully post the remaining files in another comment.

    21057-logs-6780-files-in-project-changed.zip (30.0 kB)
    21057-logs-6781-files-in-project-no-change.zip (28.9 kB)
    avatar image Mark Iannucci Chris Patterson · Nov 21, 2017 at 01:34 AM 0
    Share

    With the newer version of the agent, the agent is always building all of the projects, regardless of if there is change in the code in the subdirectory. Here's a file, 21202-logs-6803-files-in-project-changed.zip, where it was appropriate to do so (for the Clarity Report project, but not the others). And again, here's a file, 21202-logs-6804-files-in-project-no-change.zip, where it shouldn't have rebuilt any of the projects.

    Thank you in advance for your work on our behalf. Please let us know if you need more data to create the reproduction and identify a fix!

    21202-logs-6803-files-in-project-changed.zip (92.1 kB)
    21202-logs-6804-files-in-project-no-change.zip (85.6 kB)
    avatar image Karl Tews · Dec 03, 2017 at 11:27 AM 0
    Share

    Hello Mark, We have the same issue after update in July the build agent on premise to version 2.120.2 (Version 1 of the agent was deprecated on August 1, 2017). Meanwhile we have version 2.124.0 and issues still exists. We use "Continuous Integration" for build every change to matching branches and we have big solution with many projects. Behavior is changed, now all (exclude native C++) of the projects build regardless of if the underlying files changed. That drastically extended build time at every push/check-in.

    Steps to reproduce
    1. In the build definition for the "Build Clarity Solution" step (in your case) under "Advanced" set "Create Log File".
    2. Start this build once.
    3. Start the same build second time.
    4. The log file is on agent machine and is not included in zip file.
    5. Connect to the agent where the build was performed.
    6. Navigate to build directory, "C:\Source\Clarity_work\1\s" (in your case).
    7. Open the log file "Clarity.sln.log" (in your case).
    8. Look in this file for "is newer than output file".
    9. The first line found says that build process is comparing the change time of the file "C:\Source\Clarity_temp.NETFramework, Version = v4.5.2.AssemblyAttributes.cs".
    10. A few lines below the compiler "csc.exe" is called.
    Possible problem cause
    While upgrading the build agent to 2.x user specific %TEMP% environment variable for "msbuild" process is set on "<Agent>_temp" directory. However, this directory is completely cleaned up in the "Initialize Job" and "Post Job Cleanup" steps.
    Workaround (Don’t recommend changing the original targets forever)

    1. Connect to the agent where the build is running.
    2. Navigate to "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64".
    3. Open the file "Microsoft.Common.CurrentVersion.targets" and search for "GenerateTargetFrameworkMonikerAttribute".
    4. In the following node "<TargetFrameworkMonikerAssemblyAttributesPath" replace the '$([System.IO.Path]::GetTempPath())' by e.g. 'C:\MonikerTemp'.
    5. Create the directory "C:\MonikerTemp".
    6. Start this build once.
    7. Start the same build second time.
    8. If you search for "csc.exe" or "CL.exe" in the build log, no results will be found.

    avatar image Chris Patterson Karl Tews · Dec 04, 2017 at 02:01 PM 0
    Share

    Thanks for posting that it is not something that had occurred to me. You shouldn't need to change the common targets and probably shouldn't. You should be able to pass that as a property as /p:TargetFrameworkMonikerAssemblyAttributesPath to MSBuild on the command line or as an environment variable.

    We made the temp path change to help with other issues customers were facing around contention of multiple agents on the same box.

    There is a way to override that behavior by setting an environment variable on the machine VSTS_OVERWRITE_TEMP=false and then restarting the agent.

    avatar image Karl Tews Chris Patterson · Dec 04, 2017 at 03:43 PM 0
    Share

    Hello Chris, Thanks for a quick reply. Your solution "setting to environment variable on the machine VSTS_OVERWRITE_TEMP = false" works for me.
    I don’t want to change original common targets forever just as workaround. I will correct my post so no one is faking my workaround.

    Solutions

    · Add your solution
    avatar image
    0

    Added a solution by Garima Singh [MSFT] · Mar 09 at 04:07 PM

    The team has fixed the issue with incremental builds. Please open a separate ticket if you are still seeing issues.

    thub.nodes.view.add-new-comment
    Add comment · Share
    10 |10000 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users
    avatar image
    0

    Added a solution by Garima Singh [MSFT] · Mar 09 at 04:08 PM

    Thank you for your feedback! We have fixed this issue and it's available in latest VSTS and will be part of the upcoming TFS release. Thank you for helping us build a better Visual Studio Team Services!

    thub.nodes.view.add-new-comment
    Add comment · Share
    10 |10000 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users
    Follow

    41 People are following this

    avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

    Related Problems

    Team Explorer VS2013 TFS 2010 - TF30063
    0 Solution

    TFS 15 Changeset incorrectly associated to tasks automatically
    2 Solution

    TF30063 when changing Notification URL
    2 Solution

    Useful to allow tasks to be 'unassigned'
    0 Solution

    Cannot add TFS server group to Access Level
    1 Solution

    Build definition content not appearing in browser-based log
    4 Solution

    TFS10158 error when using shelveset picker to queue new build
    2 Solution

    unable to see build step logs, tfs 2017
    2 Solution

    TFS 2017, Users at Stakeholder access level doesn't have search box
    3 Solution

    Discussion work item lookup using # fails in project with custom process template
    0 Solution

    Popular
    • Windows Dev Center
    • Microsoft Azure
    • Microsoft Visual Studio
    • Office Dev Center
    • ASP.NET
    • IIS.NET
    Learning Resources
    • Channel 9
    • Windows development videos
    • Microsoft Virtual Academy
    Programs
    • Microsoft developer program
    • Windows Insider program
    • Microsoft Affiliate program
    • BizSpark (for startups)
    • Microsoft Imagine
    For IT Pros
    • Microsoft Power BI
    • Microsoft SQL Server
    • Internet of Things
    • Operations Management Suite
    English (United States)
    • Contact us
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • About our ads
    • © Microsoft 2018
    • Anonymous
    • Sign in
    • Spaces
    • Visual Studio
    • Visual Studio for Mac
    • .NET
    • C++
    • VSTS
    • TFS
    • Explore
    • Topics
    • Problems
    • Users
    • Badges