예제 #1
0
        private static Workspace GetWorkspaceFromBuild(this StLogger.Build build, params string[] preprocessorSymbols)
        {
            StLogger.Project csproj = build.Children.OfType <StLogger.Project>().FirstOrDefault();
            if (csproj == null)
            {
                throw new InvalidOperationException("cannot find cs project build");
            }

            StLogger.Item[] compileItems = Array.Empty <StLogger.Item>();
            var             properties   = new Dictionary <string, StLogger.Property>();

            foreach (StLogger.Folder folder in csproj.Children.OfType <StLogger.Folder>())
            {
                if (folder.Name == "Items")
                {
                    StLogger.Folder compileFolder = folder.Children.OfType <StLogger.Folder>().FirstOrDefault(x => x.Name == "Compile");
                    if (compileFolder == null)
                    {
                        throw new InvalidOperationException("failed to get compililation documents");
                    }

                    compileItems = compileFolder.Children.OfType <StLogger.Item>().ToArray();
                }
                else if (folder.Name == "Properties")
                {
                    properties = folder.Children.OfType <StLogger.Property>().ToDictionary(x => x.Name);
                }
            }

            StLogger.Item[] assemblies = Array.Empty <StLogger.Item>();
            foreach (StLogger.Target target in csproj.Children.OfType <StLogger.Target>())
            {
                if (target.Name == "ResolveReferences")
                {
                    StLogger.Folder folder = target.Children.OfType <StLogger.Folder>().Where(x => x.Name == "TargetOutputs").FirstOrDefault();
                    if (folder == null)
                    {
                        throw new InvalidOperationException("cannot find result of resolving assembly");
                    }

                    assemblies = folder.Children.OfType <StLogger.Item>().ToArray();
                }
            }

            var     ws            = new AdhocWorkspace();
            Project roslynProject = ws.AddProject(Path.GetFileNameWithoutExtension(csproj.ProjectFile), Microsoft.CodeAnalysis.LanguageNames.CSharp);
            var     projectDir    = properties["ProjectDir"].Value;
            Guid    pguid         = properties.ContainsKey("ProjectGuid") ? Guid.Parse(properties["ProjectGuid"].Value) : Guid.NewGuid();
            var     projectGuid   = ProjectId.CreateFromSerialized(pguid);

            foreach (StLogger.Item compile in compileItems)
            {
                var filePath    = compile.Text;
                var absFilePath = Path.Combine(projectDir, filePath);
                roslynProject = roslynProject.AddDocument(filePath, File.ReadAllText(absFilePath)).Project;
            }

            foreach (StLogger.Item asm in assemblies)
            {
                roslynProject = roslynProject.AddMetadataReference(MetadataReference.CreateFromFile(asm.Text));
            }

            var compopt = roslynProject.CompilationOptions as CSharpCompilationOptions;

            compopt = roslynProject.CompilationOptions as CSharpCompilationOptions;
            compopt = compopt ?? new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary);
            OutputKind kind;

            switch (properties["OutputType"].Value)
            {
            case "Exe":
                kind = OutputKind.ConsoleApplication;
                break;

            case "Library":
                kind = OutputKind.DynamicallyLinkedLibrary;
                break;

            default:
                kind = OutputKind.DynamicallyLinkedLibrary;
                break;
            }

            roslynProject = roslynProject.WithCompilationOptions(compopt.WithOutputKind(kind).WithAllowUnsafe(true));
            var parseopt = roslynProject.ParseOptions as CSharpParseOptions;

            roslynProject = roslynProject.WithParseOptions(parseopt.WithPreprocessorSymbols(preprocessorSymbols));
            if (!ws.TryApplyChanges(roslynProject.Solution))
            {
                throw new InvalidOperationException("failed to apply solution changes to workspace");
            }

            return(ws);
        }
        private void ProcessTaskParameter(TaskParameterEventArgs args)
        {
            string itemType = args.ItemType;
            var    items    = args.Items.OfType <ITaskItem>().ToArray();

            NamedNode parent = null;
            BaseNode  node   = null;

            if (args.Kind == TaskParameterMessageKind.TaskInput || args.Kind == TaskParameterMessageKind.TaskOutput)
            {
                var task = GetTask(args);
                if (task == null || IgnoreParameters(task))
                {
                    return;
                }

                string folderName = args.Kind == TaskParameterMessageKind.TaskInput ? Strings.Parameters : Strings.OutputItems;
                parent = task.GetOrCreateNodeWithName <Folder>(folderName);

                node = CreateParameterNode(itemType, items);
            }
            else if (
                args.Kind == TaskParameterMessageKind.AddItem ||
                args.Kind == TaskParameterMessageKind.RemoveItem ||
                args.Kind == TaskParameterMessageKind.SkippedTargetInputs ||
                args.Kind == TaskParameterMessageKind.SkippedTargetOutputs)
            {
                parent = GetTarget(args);

                NamedNode named;
                if (args.Kind == TaskParameterMessageKind.AddItem)
                {
                    named = new AddItem();
                }
                else if (args.Kind == TaskParameterMessageKind.RemoveItem)
                {
                    named = new RemoveItem();
                }
                else
                {
                    named = new Folder();
                    if (args.Kind == TaskParameterMessageKind.SkippedTargetInputs)
                    {
                        itemType = Strings.Inputs;
                    }
                    else
                    {
                        itemType = Strings.Outputs;
                    }
                }

                named.Name = itemType;

                AddItems(items, named);
                node = named;
            }

            if (node != null && parent != null)
            {
                parent.AddChild(node);
            }
        }
        /// <summary>
        /// Handles a generic BuildMessage event and assigns it to the appropriate logging node.
        /// </summary>
        /// <param name="args">The <see cref="BuildMessageEventArgs"/> instance containing the event data.</param>
        public void AddMessage(LazyFormattedBuildEventArgs args, string message)
        {
            message = Intern(message);

            TreeNode node        = null;
            var      messageNode = new Message
            {
                Text      = message,
                Timestamp = args.Timestamp
            };
            BaseNode nodeToAdd = messageNode;

            var buildEventContext = args.BuildEventContext;

            if (buildEventContext?.TaskId > 0)
            {
                node = GetTask(args);
                if (node is Task task)
                {
                    if (task.Name == "ResolveAssemblyReference")
                    {
                        Folder inputs  = task.FindChild <Folder>(Strings.Inputs);
                        Folder results = task.FindChild <Folder>(Strings.Results);
                        node = results ?? inputs;

                        if (message.StartsWith("    ", StringComparison.Ordinal))
                        {
                            message = message.Substring(4);

                            var parameter = node?.FindLastChild <Parameter>();
                            if (parameter != null)
                            {
                                bool thereWasAConflict = Strings.IsThereWasAConflictPrefix(parameter.ToString()); //parameter.ToString().StartsWith(Strings.ThereWasAConflictPrefix);
                                if (thereWasAConflict)
                                {
                                    HandleThereWasAConflict(parameter, message, stringTable);
                                    return;
                                }

                                if (!string.IsNullOrWhiteSpace(message))
                                {
                                    node = parameter;

                                    if (message.StartsWith("    ", StringComparison.Ordinal))
                                    {
                                        message = message.Substring(4);

                                        var lastItem = parameter.FindLastChild <Item>();

                                        // only indent if it's not a "For SearchPath..." message - that one needs to be directly under parameter
                                        // also don't indent if it's under AssemblyFoldersEx in Results
                                        if (lastItem != null &&
                                            !Strings.ForSearchPathPrefix.IsMatch(message) &&
                                            !parameter.Name.StartsWith("AssemblyFoldersEx", StringComparison.Ordinal))
                                        {
                                            node = lastItem;
                                        }
                                    }

                                    if (!string.IsNullOrEmpty(message))
                                    {
                                        var equals = message.IndexOf('=');
                                        if (equals != -1)
                                        {
                                            var kvp = TextUtilities.ParseNameValue(message);
                                            node.AddChild(new Metadata
                                            {
                                                Name  = Intern(kvp.Key.TrimEnd(space)),
                                                Value = Intern(kvp.Value.TrimStart(space))
                                            });
                                        }
                                        else
                                        {
                                            node.AddChild(new Item()
                                            {
                                                Text = Intern(message)
                                            });
                                        }
                                    }
                                }

                                return;
                            }
                        }
                        else
                        {
                            if (results == null)
                            {
                                bool isResult = Strings.UnifiedPrimaryReferencePrefix.IsMatch(message) ||
                                                Strings.PrimaryReferencePrefix.IsMatch(message) ||
                                                Strings.DependencyPrefix.IsMatch(message) ||
                                                Strings.UnifiedDependencyPrefix.IsMatch(message) ||
                                                Strings.AssemblyFoldersExLocation.IsMatch(message) ||
                                                Strings.IsThereWasAConflictPrefix(message);

                                if (isResult)
                                {
                                    results = task.GetOrCreateNodeWithName <Folder>(Strings.Results);
                                    node    = results;
                                }
                                else
                                {
                                    if (inputs == null)
                                    {
                                        inputs = task.GetOrCreateNodeWithName <Folder>(Strings.Inputs);
                                    }

                                    node = inputs;
                                }
                            }
                            else
                            {
                                node = results;
                            }

                            node.GetOrCreateNodeWithName <Parameter>(Intern(message.TrimEnd(':')));
                            return;
                        }
                    }
                    else if (string.Equals(task.Name, "MSBuild", StringComparison.OrdinalIgnoreCase))
                    {
                        var additionalPropertiesMatch = Strings.AdditionalPropertiesPrefix.Match(message);
                        if (message.StartsWith(Strings.GlobalPropertiesPrefix, StringComparison.Ordinal) ||
                            additionalPropertiesMatch.Success ||
                            Strings.OverridingGlobalPropertiesPrefix.IsMatch(message) ||
                            message.StartsWith(Strings.RemovingPropertiesPrefix, StringComparison.Ordinal) ||
                            Strings.RemovingProjectProperties.IsMatch(message))
                        {
                            if (additionalPropertiesMatch.Success)
                            {
                                node = node.GetOrCreateNodeWithName <Folder>(Strings.AdditionalProperties);
                            }

                            node.GetOrCreateNodeWithName <Folder>(message);
                            return;
                        }

                        node = node.FindLastChild <Folder>() ?? node;
                        if (message.Length > 2 && message[0] == ' ' && message[1] == ' ')
                        {
                            if (node is Folder f && f.Name == Strings.AdditionalProperties)
                            {
                                node = f.FindLastChild <Folder>() ?? node;
                            }

                            message = message.Substring(2);
                        }

                        var kvp = TextUtilities.ParseNameValue(message);
                        if (kvp.Value == "")
                        {
                            nodeToAdd = new Item
                            {
                                Text = Intern(kvp.Key)
                            };
                        }
                        else
                        {
                            nodeToAdd = new Property
                            {
                                Name  = Intern(kvp.Key),
                                Value = Intern(kvp.Value)
                            };
                        }
                    }
                    else if (string.Equals(task.Name, "RestoreTask"))
                    {
                        // just throw these away to save space
                        // https://github.com/NuGet/Home/issues/10383
                        if (message.StartsWith(Strings.RestoreTask_CheckingCompatibilityFor, StringComparison.Ordinal))
                        {
                            return;
                        }
                        else if (message.StartsWith("  GET", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("GET");
                        }
                        else if (message.StartsWith("  CACHE", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("CACHE");
                        }
                        else if (message.StartsWith("  OK", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("OK");
                        }
                        else if (message.StartsWith("  NotFound", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("NotFound");
                        }
                        else if (message.StartsWith("PackageSignatureVerificationLog:", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("PackageSignatureVerificationLog");
                        }
                        else if (message.StartsWith("Writing assets file to disk", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Assets file");
                        }
                        else if (message.StartsWith("Writing cache file to disk", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Cache file");
                        }
                        else if (message.StartsWith("Persisting dg to", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("dg file");
                        }
                        else if (message.StartsWith("Generating MSBuild file", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("MSBuild file");
                        }
                        else if (message.StartsWith("Lock not required", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Lock not required");
                        }
                        else if (message.StartsWith("Installing", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Installing");
                        }
                        else if (message.StartsWith("Restoring packages for", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Restoring packages for");
                        }
                        else if (message.StartsWith("Reading project file", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Reading project file");
                        }
                        else if (message.StartsWith("Scanning packages for", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Scanning packages for");
                        }
                        else if (message.StartsWith("Merging in runtimes", StringComparison.Ordinal))
                        {
                            node = node.GetOrCreateNodeWithName <Folder>("Merging in runtimes");
                        }
                        else if (
                            message.StartsWith(Strings.RestoreTask_CheckingCompatibilityFor, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_CheckingCompatibilityOfPackages, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_AcquiringLockForTheInstallation, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_AcquiredLockForTheInstallation, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_CompletedInstallationOf, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_ResolvingConflictsFor, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_AllPackagesAndProjectsAreCompatible, StringComparison.Ordinal) ||
                            message.StartsWith(Strings.RestoreTask_Committing, StringComparison.Ordinal)
                            )
                        {
                            return;
                        }
                    }
                }
            }
            else if (buildEventContext?.TargetId > 0)
            {
                node = GetTarget(args);

                if (Strings.TaskSkippedFalseCondition.Match(message).Success)
                {
                    messageNode.IsLowRelevance = true;
                }
            }
            else if (buildEventContext?.ProjectContextId > 0)
            {
                var project = construction.GetOrAddProject(buildEventContext.ProjectContextId);
                node = project;

                if (Strings.IsTargetSkipped(message))
                {
                    var targetName = Intern(TextUtilities.ParseQuotedSubstring(message));
                    if (targetName != null)
                    {
                        var skippedTarget = project.GetOrAddTargetByName(targetName, args.Timestamp);
                        skippedTarget.StartTime = args.Timestamp;
                        skippedTarget.EndTime   = args.Timestamp;
                        node = skippedTarget;
                        messageNode.IsLowRelevance = true;
                    }
                }
            }
            else if (buildEventContext.EvaluationId != -1)
            {
                node = construction.EvaluationFolder;

                var evaluationId = buildEventContext.EvaluationId;
                var evaluation   = construction.Build.FindEvaluation(evaluationId);
                if (evaluation != null)
                {
                    node = evaluation;
                }

                if (Strings.PropertyReassignmentRegex.IsMatch(message))
                {
                    TimedNode properties;
                    if (evaluation != null)
                    {
                        properties = evaluation.PropertyReassignmentFolder;
                    }
                    else
                    {
                        properties = node.GetOrCreateNodeWithName <TimedNode>(Strings.PropertyReassignmentFolder, addAtBeginning: true);
                    }

                    var propertyName = Strings.GetPropertyName(message);
                    node = properties.GetOrCreateNodeWithName <Folder>(propertyName);
                }

                if (node != null && node.FindChild <Message>(message) != null)
                {
                    // avoid duplicate messages
                    return;
                }
            }

            if (node == null)
            {
                node = construction.Build;

                if (Strings.IsEvaluationMessage(message))
                {
                    if (!evaluationMessagesAlreadySeen.Add(message))
                    {
                        return;
                    }

                    node = construction.EvaluationFolder;
                }
                else if (Strings.PropertyReassignmentRegex.IsMatch(message))
                {
                    if (!evaluationMessagesAlreadySeen.Add(message))
                    {
                        return;
                    }

                    var properties = construction.EvaluationFolder.GetOrCreateNodeWithName <Folder>(Strings.PropertyReassignmentFolder);
                    node = properties.GetOrCreateNodeWithName <Folder>(Strings.GetPropertyName(message));
                }
                else if (Strings.IsTargetDoesNotExistAndWillBeSkipped(message))
                {
                    var folder = construction.EvaluationFolder;
                    node = folder;
                    messageNode.IsLowRelevance = true;
                }
                else if (buildEventContext != null && (buildEventContext.NodeId == 0 &&
                                                       buildEventContext.ProjectContextId == 0 &&
                                                       buildEventContext.ProjectInstanceId == 0 &&
                                                       buildEventContext.TargetId == 0 &&
                                                       buildEventContext.TaskId == 0))
                {
                    // must be Detailed Build Summary
                    // https://github.com/Microsoft/msbuild/blob/master/src/XMakeBuildEngine/BackEnd/Components/Scheduler/Scheduler.cs#L509
                    DetailedSummary.AppendLine(message);
                    return;
                }
            }

            node.AddChild(nodeToAdd);
        }
        /// <summary>
        /// Handles a generic BuildMessage event and assigns it to the appropriate logging node.
        /// </summary>
        /// <param name="args">The <see cref="BuildMessageEventArgs"/> instance containing the event data.</param>
        public void AddMessage(LazyFormattedBuildEventArgs args, string message)
        {
            message = stringTable.Intern(message);

            TreeNode node        = null;
            var      messageNode = new Message
            {
                Text      = message,
                Timestamp = args.Timestamp
            };
            object nodeToAdd = messageNode;

            if (args.BuildEventContext?.TaskId > 0)
            {
                node = construction
                       .GetOrAddProject(args.BuildEventContext.ProjectContextId)
                       .GetTargetById(args.BuildEventContext.TargetId)
                       .GetTaskById(args.BuildEventContext.TaskId);
                var task = node as Task;
                if (task != null)
                {
                    if (task.Name == "ResolveAssemblyReference")
                    {
                        Folder inputs  = task.GetOrCreateNodeWithName <Folder>("Inputs");
                        Folder results = task.FindChild <Folder>("Results");
                        node = results ?? inputs;

                        if (message.StartsWith("    "))
                        {
                            message = message.Substring(4);

                            var parameter = node.FindLastChild <Parameter>();
                            if (parameter != null)
                            {
                                bool thereWasAConflict = parameter.ToString().StartsWith(Strings.ThereWasAConflictPrefix);
                                if (thereWasAConflict)
                                {
                                    HandleThereWasAConflict(parameter, message, stringTable);
                                    return;
                                }

                                if (!string.IsNullOrWhiteSpace(message))
                                {
                                    node = parameter;

                                    if (message.StartsWith("    "))
                                    {
                                        message = message.Substring(4);

                                        var lastItem = parameter.FindLastChild <Item>();

                                        // only indent if it's not a "For SearchPath..." message - that one needs to be directly under parameter
                                        // also don't indent if it's under AssemblyFoldersEx in Results
                                        if (lastItem != null &&
                                            !message.StartsWith(Strings.ForSearchPathPrefix) &&
                                            !parameter.Name.StartsWith("AssemblyFoldersEx"))
                                        {
                                            node = lastItem;
                                        }
                                    }

                                    if (!string.IsNullOrEmpty(message))
                                    {
                                        var equals = message.IndexOf('=');
                                        if (equals != -1)
                                        {
                                            var kvp = TextUtilities.ParseNameValue(message);
                                            node.AddChild(new Metadata
                                            {
                                                Name  = stringTable.Intern(kvp.Key.TrimEnd(space)),
                                                Value = stringTable.Intern(kvp.Value.TrimStart(space))
                                            });
                                        }
                                        else
                                        {
                                            node.AddChild(new Item()
                                            {
                                                Text = stringTable.Intern(message)
                                            });
                                        }
                                    }
                                }

                                return;
                            }
                        }
                        else
                        {
                            if (results == null)
                            {
                                bool isResult = message.StartsWith(Strings.UnifiedPrimaryReferencePrefix) ||
                                                message.StartsWith(Strings.PrimaryReferencePrefix) ||
                                                message.StartsWith(Strings.DependencyPrefix) ||
                                                message.StartsWith(Strings.UnifiedDependencyPrefix) ||
                                                message.StartsWith(Strings.AssemblyFoldersExLocation) ||
                                                message.StartsWith(Strings.ThereWasAConflictPrefix);

                                if (isResult)
                                {
                                    results = task.GetOrCreateNodeWithName <Folder>("Results");
                                    node    = results;
                                }
                                else
                                {
                                    node = inputs;
                                }
                            }
                            else
                            {
                                node = results;
                            }

                            node.GetOrCreateNodeWithName <Parameter>(stringTable.Intern(message.TrimEnd(':')));
                            return;
                        }
                    }
                    else if (task.Name == "MSBuild")
                    {
                        if (message.StartsWith(Strings.GlobalPropertiesPrefix) ||
                            message.StartsWith(Strings.AdditionalPropertiesPrefix) ||
                            message.StartsWith(Strings.OverridingGlobalPropertiesPrefix) ||
                            message.StartsWith(Strings.RemovingPropertiesPrefix))
                        {
                            node.GetOrCreateNodeWithName <Folder>(message);
                            return;
                        }

                        node = node.FindLastChild <Folder>();
                        if (message[0] == ' ' && message[1] == ' ')
                        {
                            message = message.Substring(2);
                        }

                        var kvp = TextUtilities.ParseNameValue(message);
                        if (kvp.Value == "")
                        {
                            nodeToAdd = new Item
                            {
                                Text = stringTable.Intern(kvp.Key)
                            };
                        }
                        else
                        {
                            nodeToAdd = new Property
                            {
                                Name  = stringTable.Intern(kvp.Key),
                                Value = stringTable.Intern(kvp.Value)
                            };
                        }
                    }
                }
            }
            else if (args.BuildEventContext?.TargetId > 0)
            {
                node = construction
                       .GetOrAddProject(args.BuildEventContext.ProjectContextId)
                       .GetTargetById(args.BuildEventContext.TargetId);

                if (Strings.IsTaskSkipped(message))
                {
                    messageNode.IsLowRelevance = true;
                }
            }
            else if (args.BuildEventContext?.ProjectContextId > 0)
            {
                var project = construction.GetOrAddProject(args.BuildEventContext.ProjectContextId);
                node = project;

                if (Strings.IsTargetSkipped(message))
                {
                    var targetName = stringTable.Intern(TextUtilities.ParseQuotedSubstring(message));
                    if (targetName != null)
                    {
                        node = project.GetOrAddTargetByName(targetName);
                        messageNode.IsLowRelevance = true;
                    }
                }
            }
            else if (Reflector.GetEvaluationId(args.BuildEventContext) is int evaluationId && evaluationId != -1)
            {
                var evaluation = construction.EvaluationFolder;
                var project    = evaluation.FindChild <Project>(p => p.Id == evaluationId);
                node = project;

                if (node != null && node.FindChild <Message>(message) != null)
                {
                    // avoid duplicate messages
                    return;
                }
            }

            if (node == null)
            {
                node = construction.Build;

                if (Strings.IsEvaluationMessage(message))
                {
                    if (!evaluationMessagesAlreadySeen.Add(message))
                    {
                        return;
                    }

                    node = construction.EvaluationFolder;
                }
                else if (Strings.IsTargetDoesNotExistAndWillBeSkipped(message))
                {
                    var folder = construction.EvaluationFolder;
                    node = folder;
                    messageNode.IsLowRelevance = true;
                }
                else if (args.BuildEventContext != null && (args.BuildEventContext.NodeId == 0 &&
                                                            args.BuildEventContext.ProjectContextId == 0 &&
                                                            args.BuildEventContext.ProjectInstanceId == 0 &&
                                                            args.BuildEventContext.TargetId == 0 &&
                                                            args.BuildEventContext.TaskId == 0))
                {
                    // must be Detailed Build Summary
                    // https://github.com/Microsoft/msbuild/blob/master/src/XMakeBuildEngine/BackEnd/Components/Scheduler/Scheduler.cs#L509
                    DetailedSummary.AppendLine(message);
                    return;
                }
            }

            node.AddChild(nodeToAdd);
        }