cyclonedx-dotnet: Enhancement request - do not assume 'obj' folder name
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
- feat(analyzer): support resolving project.assets.json via MSBuild property Adds support for determining the location of project.assets.json using dotnet msbuild -getProperty:ProjectAssetsFile, enabli... — committed to CycloneDX/cyclonedx-dotnet by mtsfoni a year ago
- feat(analyzer): support resolving project.assets.json via MSBuild property (#952) Adds support for determining the location of project.assets.json using dotnet msbuild -getProperty:ProjectAssetsFile,... — committed to CycloneDX/cyclonedx-dotnet by mtsfoni a year ago
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:
So i was able to reproduce it, by setting
Project/PropertyGroup/BaseIntermediateOutputPathfor example tointermediate\then everything that usually goes into the obj-folder goes intointermediate.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.