-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SBOM Task Outputs Directly to Console Instead of Using MSBuild Logging APIs #712
Comments
For MSBuild on .NET Framework ( |
IMO this one is a blocker for including the targets in the .NET SDK - the output is not guaranteed at all so this Target will create spew all over the stdout. I think that making a bridge between Microsoft.Extensions.Logging.ILogger/Serilog logging and MSBuild's Logging infrastructure should be at least workable - though as @KalleOlaviNiemitalo the Warning/Error format would need checking. I tried making such a bridge (we had to do similar for Containers ) but I think more would be needed because of the use of Serilog here. |
@baronfel @KalleOlaviNiemitalo I assumed that you get MSBuild logging for free when using ToolTasks, is that not the case? I have fixed the issue that was blocking the .NET framework case and in my testing its logging output visually appears to be coming via the MSBuild APIs but I'm not entirely sure how to tell. As for the non-.NET framework case, it seems like some additional investigation is required here to figure out how best to implement this. My first thought was to add an option to |
@sfoslund ToolTask does do the logging - the case I was talking about was the modern .NET case. I think your proposed path should be ok - you know the logging infra for your tool better than I do :) - and I don't have any specific requirements there aside from "don't write directly to stdout". |
Sounds good, I have a branch where I seem to have things working when testing e2e but some tests are failing due to a missing MSBuild assembly and the task logging before being initialized. Unfortunately I am being pulled off this work so I likely won't be able to look further into this any time in the near future, but we will be happy to accept contributions if anyone wants to work off of these changes and prep a PR. |
When using the SBOM task in an MSBuild project, the task outputs messages directly to the console rather than utilizing MSBuild's Logging APIs. This behavior results in cluttered and unstructured console output, which is not consistent with standard MSBuild practices. Proper logging through MSBuild's APIs would allow for better categorization and filtering of messages.
Steps to Reproduce:
dotnet pack -bl
to build the project with a binary log.Expected behavior:
Sbom task should output messages through MSBuild logging APIs & categorized appropriately.
We can utilize
TaskLoggingHelper
:The text was updated successfully, but these errors were encountered: