Meziantou.Framework.DependencyScanning
2.0.12
Prefix Reserved
dotnet add package Meziantou.Framework.DependencyScanning --version 2.0.12
NuGet\Install-Package Meziantou.Framework.DependencyScanning -Version 2.0.12
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.DependencyScanning" Version="2.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.DependencyScanning" Version="2.0.12" />
<PackageReference Include="Meziantou.Framework.DependencyScanning" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.DependencyScanning --version 2.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Meziantou.Framework.DependencyScanning, 2.0.12"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.DependencyScanning@2.0.12
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.DependencyScanning&version=2.0.12
#tool nuget:?package=Meziantou.Framework.DependencyScanning&version=2.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Meziantou.Framework.DependencyScanning
A .NET library for scanning source code directories and files to discover and manage project dependencies across multiple package ecosystems and configuration formats.
Features
- Multi-format Support: Scan dependencies from various project files and configuration formats
- Multiple Package Ecosystems: NuGet, npm, PyPI, Docker, Ruby Gems, Helm Charts, and more
- Parallel Scanning: High-performance parallel file scanning with configurable degree of parallelism
- Dependency Updates: Locate and update dependency versions programmatically
- Customizable Scanning: Filter by file patterns, dependency types, and custom predicates
Supported Dependency Types
The library can detect the following dependency types:
- NuGet - .NET packages from NuGet.org
- Npm - JavaScript packages from npmjs.com
- PyPi - Python packages from PyPI
- DockerImage - Docker container images
- GitReference - Git submodules and references
- DotNetSdk - .NET SDK versions
- DotNetTargetFramework - .NET target frameworks
- GitHubActions - GitHub Actions workflows and reusable workflows
- AzureDevOpsVMPool - Azure DevOps VM pool images
- AzureDevOpsTask - Azure DevOps pipeline tasks
- AzureDevOpsTemplate - Azure DevOps pipeline templates
- HelmChart - Helm chart dependencies
- RubyGem - Ruby gems
- RenovateConfiguration - Renovate configuration extends
- MSBuildProjectReference - MSBuild project references
Usage
Scan a Directory
using Meziantou.Framework.DependencyScanning;
// Scan with default options
var dependencies = await DependencyScanner.ScanDirectoryAsync(
"C:\\MyProject",
options: null,
cancellationToken);
foreach (var dependency in dependencies)
{
Console.WriteLine($"{dependency.Type}: {dependency.Name}@{dependency.Version}");
}
Scan with Custom Options
var options = new ScannerOptions
{
// Number of parallel scanning tasks (default: 16)
DegreeOfParallelism = 8,
// Recurse into subdirectories (default: true)
RecurseSubdirectories = true,
// Filter files to scan
ShouldScanFilePredicate = (directory, fileName) =>
{
return !fileName.StartsWith(".");
},
// Filter directories to recurse into
ShouldRecursePredicate = (directory, name) =>
{
return name != "node_modules" && name != "bin";
}
};
var dependencies = await DependencyScanner.ScanDirectoryAsync(
@"C:\MyProject",
options,
cancellationToken);
Filter by Dependency Type
var options = new ScannerOptions
{
// Only scan for specific dependency types
IncludedDependencyTypes = [DependencyType.NuGet, DependencyType.Npm].ToImmutableHashSet(),
};
// Or exclude specific types
var options2 = new ScannerOptions
{
ExcludedDependencyTypes = [DependencyType.DockerImage].ToImmutableHashSet(),
};
Stream Dependencies as They're Found
await DependencyScanner.ScanDirectoryAsync(
"C:\\MyProject",
options: null,
onDependencyFound: dependency =>
{
Console.WriteLine($"Found: {dependency.Name}@{dependency.Version}");
},
cancellationToken);
Scan Individual Files
// Scan a single file
var dependencies = await DependencyScanner.ScanFileAsync(
rootDirectory: "C:\\MyProject",
filePath: "C:\\MyProject\\package.json",
options: null,
cancellationToken);
// Scan multiple specific files
var filePaths = new[]
{
"C:\\MyProject\\package.json",
"C:\\MyProject\\MyProject.csproj"
};
var dependencies = await DependencyScanner.ScanFilesAsync(
rootDirectory: "C:\\MyProject",
filePaths,
options: null,
cancellationToken);
Update Dependency Versions
var dependencies = await DependencyScanner.ScanDirectoryAsync(
"C:\\MyProject",
options: null,
cancellationToken);
// Update all NuGet packages to version 2.0.0
foreach (var dependency in dependencies.Where(d => d.Type == DependencyType.NuGet))
{
if (dependency.VersionLocation?.IsUpdatable == true)
{
await dependency.UpdateVersionAsync("2.0.0", cancellationToken);
}
}
Custom Regex Scanner
For custom file formats, you can use the RegexScanner:
var options = new ScannerOptions
{
Scanners =
[
new RegexScanner
{
FilePatterns = [Glob.Parse("**/*.custom", GlobOptions.IgnoreCase)],
DependencyType = DependencyType.DockerImage,
RegexPattern = @"image:\s*(?<name>[a-z/]+)(:(?<version>[0-9.]+))?"
}
]
};
var dependencies = await DependencyScanner.ScanDirectoryAsync(
"C:\\MyProject",
options,
cancellationToken);
The regex pattern must include named groups:
name- The dependency name (required)version- The dependency version (optional)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- LibGit2Sharp (>= 0.31.0)
- Meziantou.Framework.Globbing (>= 2.1.2)
- YamlDotNet (>= 17.1.0)
-
net8.0
- LibGit2Sharp (>= 0.31.0)
- Meziantou.Framework.Globbing (>= 2.1.2)
- YamlDotNet (>= 17.1.0)
-
net9.0
- LibGit2Sharp (>= 0.31.0)
- Meziantou.Framework.Globbing (>= 2.1.2)
- YamlDotNet (>= 17.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.12 | 47 | 5/3/2026 |
| 2.0.11 | 184 | 4/25/2026 |
| 2.0.10 | 192 | 4/12/2026 |
| 2.0.9 | 140 | 3/29/2026 |
| 2.0.8 | 151 | 3/22/2026 |
| 2.0.7 | 640 | 1/25/2026 |
| 2.0.6 | 266 | 1/18/2026 |
| 2.0.5 | 1,024 | 11/16/2025 |
| 2.0.4 | 400 | 10/27/2025 |
| 2.0.3 | 136 | 10/19/2025 |
| 2.0.2 | 210 | 10/5/2025 |
| 2.0.1 | 205 | 9/21/2025 |
| 2.0.0 | 195 | 9/6/2025 |
| 1.3.1 | 1,284 | 9/3/2025 |
| 1.3.0 | 1,927 | 4/26/2025 |
| 1.2.4 | 776 | 3/1/2025 |
| 1.2.3 | 1,685 | 12/7/2024 |
| 1.2.2 | 332 | 11/27/2024 |
| 1.2.1 | 387 | 11/17/2024 |
| 1.2.0 | 164 | 11/12/2024 |
Loading failed