Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7637269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:53:41+00:00 2026-05-31T07:53:41+00:00

We’re attempting to clean up a big bunch of brown field code, while at

  • 0

We’re attempting to clean up a big bunch of brown field code, while at the same time a team is adding new functionality. We’d like to make sure changed and new code is cleaned from any compiler/code analysis or other warnings, but there’s too many of them to begin by cleaning up the current solution.

We’re using TFS 2010.

So the following was proposed:

  • Write/select a build activity which compares the list of warnings in the build against the lines of code that changed with that check-in.
  • If the warning provides a line number, and that line number was changed, fail the build.

I understand this will not find all new warnings and things introduced in other parts of the code will not be flagged, but it’s at least something.

Another option that was proposed:

  • Compare the list of warnings of the previous known good build against the list of this build. If there are new warnings (track on file name level), fail the build.

Any known Actions out there that might provide said functionality?

Any similar Actions that can act on Code Coverage reports?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:53:43+00:00Added an answer on May 31, 2026 at 7:53 am

    This following activity is just a basic approach, that returns false if your current build has less or equal warnings than your last build and true if they have risen.
    Another activity that can locate new warnings and/or present with their location in code would clearly be superior, yet I thought this might be an interesting startpoint:

    using System;
    using System.Activities;
    using Microsoft.TeamFoundation.Build.Client;
    using Microsoft.TeamFoundation.Build.Workflow.Activities;
    
    namespace CheckWarnings
    {
        [BuildActivity(HostEnvironmentOption.Agent)]
        public sealed class CheckWarnings : CodeActivity<bool>
        {
            [RequiredArgument]
            public InArgument<IBuildDetail> CurrentBuild { get; set; }  //buildDetail
            public InArgument<string> Configuration { get; set; }       //platformConfiguration.Configuration
            public InArgument<string> Platform { get; set; }            //platformConfiguration.Platform
    
    
            protected override bool Execute(CodeActivityContext context)
            {
                IBuildDetail currentBuildDetail = context.GetValue(CurrentBuild);
                string currentConfiguration = context.GetValue(Configuration);
                string currentPlatform = context.GetValue(Platform);
    
                Uri lastKnownGoodBuildUri = currentBuildDetail.BuildDefinition.LastGoodBuildUri;
                IBuildDetail lastKnownGoodBuild = currentBuildDetail.BuildServer.GetBuild(lastKnownGoodBuildUri);
    
                int numOfCurrentWarnings = GetNumberOfWarnings(currentBuildDetail, currentConfiguration, currentPlatform);
                context.TrackBuildMessage("Current compile presents " + numOfCurrentWarnings + " warnings.", BuildMessageImportance.Normal);
    
                int numOfLastGoodBuildWarnings = GetNumberOfWarnings(lastKnownGoodBuild, currentConfiguration,
                                                                     currentPlatform);
                context.TrackBuildMessage("Equivalent last good build compile presents " + numOfLastGoodBuildWarnings + " warnings.", BuildMessageImportance.Normal);
    
                if (numOfLastGoodBuildWarnings < numOfCurrentWarnings)
                {
                    return true;
                }
                return false;
            }
    
            private static int GetNumberOfWarnings(IBuildDetail buildDetail, string configuration, string platform)
            {
                var buildInformationNodes =
                    buildDetail.Information.GetNodesByType("ConfigurationSummary");
    
                foreach (var buildInformationNode in buildInformationNodes)
                {
                    string localPlatform, numOfWarnings;
                    string localConfiguration = localPlatform = numOfWarnings = "";
                    foreach (var field in buildInformationNode.Fields)
                    {
    
                        if (field.Key == "Flavor")
                        {
                            localConfiguration = field.Value;
                        }
                        if (field.Key == "Platform")
                        {
                            localPlatform = field.Value;
                        }
                        if (field.Key == "TotalCompilationWarnings")
                        {
                            numOfWarnings = field.Value;
                        }
                    }
                    if(localConfiguration == configuration && localPlatform == platform)
                    {
                        return Convert.ToInt32((numOfWarnings));
                    }
                }
                return 0;
            }
        }
    }
    

    Note that this activity doesn’t provide with exception handling and should further be refined, in case your build definitions build more than one solutions.

    It takes three input args (buildDetail, platformConfiguration.Configuration and platformConfiguration.Platform) and should be placed directly after the Run MSBuild activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I'm parsing an XML file, the creators of it stuck in a bunch social
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.