Open rainersigwald opened 8 months ago
@rainersigwald silly thought - should we try to use the Outputs
from the directly-requested Task(s)? Is that good enough? What would that look like for existing commonly-requested targets?
Not silly at all. Right now that would require:
ProjectStartedEventArgs
for TargetNames
TargetFinishedEventArgs
for those specific TargetNames
TargetOutputs
for the targets we care aboutWe'd have to filter the lists from 1 because in normal execution there are different calls to a project with different entry points ("get list of TFs"/build/"get random other outputs") only some of which are really relevant to the user.
Current requests for this include
Our usage here would be for run attachments, such as TRX, code coverage or process dumps. There can be 0, 1 or multiple files per project.
Another use case for this might be the Quickbuild cache plugin - when that triggers projects don't appear like they are built at all. with this feature the plugin could report the cached results on behalf of the projects that were not actually built.
We should consider special-casing output detection for Pack for .NET 9 as well. When packaging, a message like the following is emitted:
Successfully created package 'E:\Code\FsAutoComplete\src\FsAutoComplete\bin\Release\fsautocomplete.0.74.0.nupkg'.
(NOTE: this message will be localized). In addition, the GenerateNuspec
Target has outputs in the form of the NuGetPackOutput
Item type:
If the target to build for a project was Pack
and NuGetPackOutput
is available, we could use that to get a structured view of the package to treat as the output.
The logged Message doesn't provide a Code so we can't look for it structurally: https://github.com/NuGet/NuGet.Client/blob/f929a0f74b92c3593521a4556d41d6f96528fb24/src/NuGet.Core/NuGet.Commands/CommandRunners/PackCommandRunner.cs#L202C37-L204
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:
ProjectFinishedEventArgs
to have an optional list of critical outputs, derived from an item that can be manipulated during the build.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.