4

We are using TFS server 2012 and have CI builds set up on a build server.

Currently, the build result is "Failed" if anything failed to compile, "Partially Succeeded" if there are any unit test failures, and "Succeeded" otherwise.

My problem is that I don't want the result to be "Succeeded" if there are any build warnings, whether they be compiler warnings, Code Analysis warnings , StyleCop warnings, or whatever.

Is there any way to modify the build configuration so that the presence of warnings causes the result to be "Partially Succeeded" instead of "Succeeeded"?

4

2 回答 2

1

build is reported as "Partially Succeeded" when the "Test Success" property is set to "False" and "CompilationSuccess"="True". So you can add customized activity that check theses properties, add this activity to tour new template of build.

于 2013-11-06T16:10:12.467 回答
1

Below custom activity will set build status to PartiallySucceeded:

   [BuildActivity(HostEnvironmentOption.Agent)]
    public class Activity : CodeActivity
    {
         protected override void Execute(CodeActivityContext context)
         {
              IBuildDetail build = context.GetExtension<IBuildDetail>();
              build.Status = BuildStatus.PartiallySucceeded;
              build.Save();
         }
    }

Other possible choices include:

All All status applies.

Failed Build failed.

InProgress Build is in progress.

None No status available.

NotStarted Build is not started.

PartiallySucceeded Build is partially succeeded.

Stopped Build is stopped.

Succeeded Build succeeded.

于 2016-06-13T15:18:33.943 回答