dotnet / dotnet/msbuild

Generalize "Primary output(s)" detection for TerminalLogger

Open
#9,608 6 comments 2 reactions 0 assignees View on GitHub
Area: Terminal Logger backlog Feature Request Priority:3 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Currently, TL scans through high-priority messages looking for ` -> ` to determine what the "primary output" of a given project is in order to render the "project succeeded" message with the path of and a link to that output.

https://github.com/dotnet/msbuild/blob/69a76bb6d3068af5e655e15cf0d290d44cf77672/src/MSBuild/TerminalLogger/TerminalLogger.cs#L554-L556

This is clunky and a structured approach would be cleaner. In addition, the currently-logged message isn't always the "right" output, and it'd be nice if it was more customizable by individual projects (see also https://github.com/dotnet/msbuild/issues/8370#issuecomment-1873016590).

I can think of a couple of ways to do this:

1. augment `ProjectFinishedEventArgs` to have an optional list of critical outputs, derived from an item that can be manipulated during the build.
2. Create a new special target to return that and special-case that target's `TargetFinished` event in the logger.

The former is more complex and we'd have to be mindful of the perf cost of the item lookup at project-finished time, but it's more flexible in the case of multiple invocations of the same project instance (for instance, build and publish the same project in separate invocations). A target would get single-instanced.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.