dotnet / dotnet/msbuild

Integrate Microsoft.Extensions.Logging ILogger with MSBuild's logging abstractions

Open
#10,757 7 comments 4 reactions 0 assignees View on GitHub
Area: Logging backlog gathering-feedback needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

> Ok, thanks - that makes sense. Crazy that this was working for so long. Not sure what broke it, but clear I was depending on something I should not.
>
> Separately, there is basically no bridge to Microsoft DI, which makes writing MSBuild tasks that reference transitive projects difficult - so it's hard to modularize MSBuild. It turns out Coverlet uses Serilog MSBuildSink, but nothing exists for Microsoft.Extensions.Logging. I wrote a dumb one here : https://github.com/fluentmigrator/fluentmigrator/blob/main/src/FluentMigrator.MSBuild/MicrosoftBuildLogger.cs

from @jzabroski in https://github.com/dotnet/msbuild/issues/10756

This is a recurring problem. The [SDK Containers](https://github.com/dotnet/sdk/blob/116fe7549a8f7f2417bb19fcb620874b7155ced8/src/Containers/Microsoft.NET.Build.Containers/Logging/MSBuildLogger.cs) have a simple version of an ILogger<->MEL.ILogger mapping, the SBOM targets do as well, and a number of MSBuild integrations I've written in the past for my own tools (Ionide/FSAutoComplete, Ionide/Proj-Info, etc) all have separate implementations.

We should develop and ship a 'blessed' ILogger implementation that interops with MEL.ILogger, and it should be able to handle MSBuild ILogger specific concepts like
* codes
* line numbers
* file paths

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.