Skip to content

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

@baronfel

Description

@baronfel

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 #10756

This is a recurring problem. The SDK Containers 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Loggingbackloggathering-feedbackThe issue requires feedback in order to be planned, please comment if the feature is useful for youneeds-designRequires discussion with the dev team before attempting a fix.triaged

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions