Skip to content

Commit 8874da6

Browse files
amitla1JamieMagee
andauthored
Added NuGet Detector Doc (#567)
* Create nuget.md * Update nuget.md * Update README.md * Update nuget.md * Update nuget.md * Update docs/detectors/nuget.md * Update nuget.md --------- Co-authored-by: Jamie Magee <jamagee@microsoft.com>
1 parent d95e235 commit 8874da6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

docs/detectors/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
| LinuxContainerDetector | Stable |
3838

3939
- [Maven](maven.md)
40+
- NPM
41+
- [NuGet](nuget.md)
4042

4143
| Detector | Status |
4244
| ------------------------- | ------ |

docs/detectors/nuget.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# NuGet Detection
2+
3+
## Requirements
4+
5+
NuGet Detection depends on the following to successfully run:
6+
7+
- One or more `*.nuspec`, `*.nupkg`, `*.packages.config`, or `.*csproj` files.
8+
- The files each NuGet detector searches for:
9+
- [The `NuGet` detector looks for `*.nupkg`, `*.nuspec`, `nuget.config`, `paket.lock`][1]
10+
- [The `NuGetPackagesConfig` detector looks for `packages.config`][2]
11+
- [The `NuGetProjectCentric` detector looks for `project.assets.json`][3]
12+
13+
[1]: https://github.com/microsoft/component-detection/blob/13f3e9f32c94bf6189fbd0bfbdf2e68cc60fccd9/src/Microsoft.ComponentDetection.Detectors/nuget/NuGetComponentDetector.cs#L40
14+
[2]: https://github.com/microsoft/component-detection/blob/13f3e9f32c94bf6189fbd0bfbdf2e68cc60fccd9/src/Microsoft.ComponentDetection.Detectors/nuget/NuGetPackagesConfigDetector.cs#L25
15+
[3]: https://github.com/microsoft/component-detection/blob/13f3e9f32c94bf6189fbd0bfbdf2e68cc60fccd9/src/Microsoft.ComponentDetection.Detectors/nuget/NuGetProjectModelProjectCentricComponentDetector.cs#L205
16+
17+
## Detection Strategy
18+
19+
NuGet Detection is performed by parsing any `*.nuspec`, `*.nupkg`, `*.packages.config`, or `*.project.assets` files found under the scan directory. By searching for all `*.nuspec,` `*.nupkg` files on disk the global NuGet cache gets searched which can include packages that are not included in the final build.
20+
21+
## Known Limitations
22+
23+
- The NuGet detector is currently overreporting because the global NuGet cache gets searched. This is because of NuGet's [restore behaviour][4] which downloads all possible dependencies before [resolving the final dependency graph][5]. To solve this overreporting a new NuGet Detector approach will be rolled out. This new approach will now only parse `*.packages.config` and `*.project.assets` (`*.csproj`) files. This means any components that are only found in `*.nuspec` or `*.nupkg` files will not be detected with the new NuGet Detector approach.
24+
- There are also dependencies from the .NET SDK that are underreported. The list of dependencies can be found [here][6].
25+
26+
[4]: https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#package-restore-behavior
27+
[5]: https://learn.microsoft.com/en-us/nuget/concepts/dependency-resolution
28+
[6]: https://github.com/microsoft/component-detection/blob/13f3e9f32c94bf6189fbd0bfbdf2e68cc60fccd9/src/Microsoft.ComponentDetection.Detectors/nuget/NuGetProjectModelProjectCentricComponentDetector.cs#L31-L185
29+

0 commit comments

Comments
 (0)