Meziantou.Framework.DependencyScanning 2.0.5

Prefix Reserved
dotnet add package Meziantou.Framework.DependencyScanning --version 2.0.5
                    
NuGet\Install-Package Meziantou.Framework.DependencyScanning -Version 2.0.5
                    
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.5" />
                    
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.5" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.DependencyScanning" />
                    
Project file
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.5
                    
#r "nuget: Meziantou.Framework.DependencyScanning, 2.0.5"
                    
#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.5
                    
#: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.5
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.DependencyScanning&version=2.0.5
                    
Install as a Cake Tool

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 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.

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.5 180 11/16/2025
2.0.4 240 10/27/2025
2.0.3 119 10/19/2025
2.0.2 194 10/5/2025
2.0.1 188 9/21/2025
2.0.0 178 9/6/2025
1.3.1 1,266 9/3/2025
1.3.0 1,890 4/26/2025
1.2.4 764 3/1/2025
1.2.3 1,667 12/7/2024
1.2.2 315 11/27/2024
1.2.1 375 11/17/2024
1.2.0 152 11/12/2024
1.1.0 295 11/8/2024
1.0.12 664 10/17/2024
1.0.11 128 10/17/2024
1.0.10 177 10/16/2024
1.0.9 179 10/16/2024
1.0.8 182 10/15/2024
1.0.7 148 10/10/2024
1.0.6 500 9/24/2024
1.0.5 258 9/23/2024
1.0.4 149 9/22/2024
1.0.3 375 6/24/2024
1.0.2 259 12/19/2023
1.0.1 215 11/15/2023
1.0.0 255 7/23/2023
1.0.0-alpha.11 211 8/22/2022
1.0.0-alpha.10 227 8/21/2022
1.0.0-alpha.9 335 4/20/2022
1.0.0-alpha.8 223 4/20/2022
1.0.0-alpha.7 353 7/14/2021
1.0.0-alpha.6 316 4/22/2021
1.0.0-alpha.5 319 4/22/2021
1.0.0-alpha.4 274 4/21/2021
1.0.0-alpha.3 337 12/26/2020
1.0.0-alpha.2 342 12/26/2020
1.0.0-alpha 444 10/8/2020