Skip to content
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

[Microsoft.Sbom.Targets] Microsoft.Sbom.Tool.exe not found, with MSBuild on .NET Framework #719

Closed
Tracked by #693
KalleOlaviNiemitalo opened this issue Sep 19, 2024 · 2 comments · Fixed by #722
Closed
Tracked by #693
Labels
needs triage Default status upon issue submission

Comments

@KalleOlaviNiemitalo
Copy link

I tried adding the Microsoft.Sbom.Targets 2.2.8 package to a project (thus not using the upcoming feature dotnet/sdk#43151) and setting some properties. With .NET SDK 8.0.304, dotnet build and dotnet pack work OK, and the resulting NuGet package contains an SBOM file (although it doesn't contain all the information I expected). However, packing in Visual Studio 2022 does not work:

[REDACTED]\.nuget\packages\microsoft.sbom.targets\2.2.8\buildMultiTargeting\Microsoft.Sbom.Targets.targets(57,5): error MSB6004: The specified task executable location "[REDACTED]\.nuget\packages\microsoft.sbom.targets\2.2.8\buildMultiTargeting\..\tasks\net472\sbom-tool\Microsoft.Sbom.Tool.exe" is invalid.

So it's apparently trying to execute the SBOM CLI Tool as described in #674 (comment):

  1. SbomCLIToolTask.cs is invoked if the MSBuild version targets the "Full" (.NET Framework) runtime bundled with Visual Studio. Because the SBOM API does not support .NET Framework, this class utilizes the SBOM CLI Tool to generate an SBOM.

but the tool is not included in the package.

Originally posted by @KalleOlaviNiemitalo in #693 (comment)

@baronfel
Copy link
Member

This is the other blocker for incusion in the .NET SDK IMO - we must be able to support Visual Studio. I believe this is just a packaging issue - the runtime publish outputs from the tool aren't in the package. With a bit of binlog investigation this should be doable.

@KalleOlaviNiemitalo
Copy link
Author

AfterTargets="Build" here may be too late:

<Target Name="AddSbomToolToPackage" AfterTargets="Build">

Compare to how MSBuild adds files to a package: https://github.com/dotnet/msbuild/blob/e86e6dd2f4e45a433c444d732779d6e2e5f6c320/src/MSBuild/MSBuild.csproj#L234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Default status upon issue submission
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants