sdk
sdk copied to clipboard
Add optional logging to MSBuild SDK Resolver
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.
@jeffkl Could you look at this again. I've switched it so that it logs to the SdkLogger, but only for resolution failures. It uses FormattableString
now so it shouldn't be formatting the log strings unless they are actually going to be emitted.
This is a huge improvement. Will these be on by default? How will this look in a binlog or a text log?
Is my analysis correct that the SdkLogger was not used for anything prior to this change? https://github.com/dotnet/msbuild/issues/7988#issuecomment-1251782434
This is a huge improvement. Will these be on by default? How will this look in a binlog or a text log?
The current version of this PR will log the messages by default any time there is a resolver failure. When I tested it out, the logs showed up in the console output and in the binlog. I'm not sure if anything else previously used the SdkLogger.
/azp run
Azure Pipelines successfully started running 1 pipeline(s).
@dotnet/msbuild Is it expected that SdkResolverContext.Logger
would be null on Mac and Linux? That seems to be the case based on some of the test failures.
EDIT: Never mind, it was actually an issue with how the mocks were set up.
@dsplaisted I have some comments waiting for a reply.
@jeffkl Sorry, I missed those comments, I think I thought they applied to a previous version of the code and were now outdated.
The description of this PR still mentions "logs to the temporary directory", which is not what the implementation does.
In https://github.com/NuGet/Home/issues/10669#issuecomment-804619192, I suggested logging the referenced MSBuild project SDKs to a file, which a separate tool could then read in order to check the licenses of these dependencies. If I understand correctly, this PR does not fulfil that request, in two respects:
- it doesn't log the SDKs if resolution succeeds
- MSBuild project SDKs from NuGet packages are resolved by NuGetSdkResolver; not by DotNetMSBuildSdkResolver, which this PR modifies
@KalleOlaviNiemitalo I've updated the description to match what the PR now does.
It's true this PR doesn't really help with your scenario of auditing which NuGet project SDKs are used.