cyclonedx-dotnet: Enhancement request - do not assume 'obj' folder name

https://github.com/CycloneDX/cyclonedx-dotnet/blob/16ffa29cc371fbd99825b4afff644dd32fd53519/CycloneDX/Services/ProjectFileService.cs#L94

This code assumes the directory specified using the -biop flag is the parent of the obj folder. However, MSBuild provides you the ability to rename object folders to another name (such as .obj). Assuming the folder is always <parent>/obj/<subfolder> seems unnecessary. To avoid a breaking change here, you might be able to check if that path exists, and then use it, but otherwise try just directly using the directory specified with -biop.

To get around this, we are manually copying our intermediate directory to another location (<directory>/obj) and then passing <directory> to -biop flag.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Working now with 5.3.1 👍

Suggestion: if the .NET SDK is installed and is 9.0.100 or later, you could try querying it to get the path of the outputs once the projects have been enumerated:

❯ dotnet msbuild .\src\Polly.Core\Polly.Core.csproj -getProperty:ArtifactsPath
D:\Coding\App-vNext\Polly\artifacts

So i was able to reproduce it, by setting Project/PropertyGroup/BaseIntermediateOutputPath for example to intermediate\ then everything that usually goes into the obj-folder goes into intermediate.

Interestingly, even though there is a project property, setting it does not transfer everything, but only the content of obj\Debug. It must apparently be set in the Directory.Build.props.

My plan is to deprecate the current -biop / --BaseIntermediateOutputPath and add a new one, that doesn’t assume the obj.

I think I actually saw code in another class that checks the proj file for the obj-output folder.

This shouldn’t be a big deal, i’ll try to push it in.