SlimDep 1.0.0-preview.1

This is a prerelease version of SlimDep.
dotnet tool install --global SlimDep --version 1.0.0-preview.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SlimDep --version 1.0.0-preview.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SlimDep&version=1.0.0-preview.1&prerelease
                    
nuke :add-package SlimDep --version 1.0.0-preview.1
                    

SlimDep

NuGet License: MIT

SlimDep is a .NET global tool (v1.0.0-preview.1) that detects and removes unused NuGet package references from .csproj files.

Over time, .NET projects accumulate dead package references — packages added during development or experimentation that are never cleaned up. SlimDep finds them automatically and can remove them in one command.

Supports .NET 8, 9, and 10.


Installation

dotnet tool install --global SlimDep

Once installed, the slimdep command is available everywhere on your machine.

dotnet tool update --global SlimDep    # update
dotnet tool uninstall --global SlimDep # uninstall

Before You Scan

Your project must be restored so obj/project.assets.json exists:

dotnet restore

SlimDep does not require a build — only a restore.


Commands

slimdep --version

slimdep --version
# output: 1.0.0-preview.1

slimdep scan — Detect unused packages

slimdep scan <project> [options]

Argument

Argument Description
<project> Path to a .csproj file or a folder (all .csproj files found recursively, obj/ excluded)

Options

Option Default Description
--format console Output format: console or json
--output <file> (stdout) Write report to a file instead of printing
--include-transitive off Also check transitive (indirect) packages
-?, -h, --help Show help

Examples:

# Scan a single project
slimdep scan MyApp.csproj

# Scan an entire solution folder (all .csproj files found recursively)
slimdep scan C:\Dev\MySolution

# JSON output saved to a file
slimdep scan MyApp.csproj --format json --output report.json

# Include transitive dependencies
slimdep scan MyApp.csproj --include-transitive

Sample console output:

Found 3 project(s).
Scanning MyApp.Api.csproj ...

  Project : C:\Dev\MySolution\src\MyApp.Api\MyApp.Api.csproj
  Packages: 8 direct reference(s) analysed
  Duration: 142 ms

  ✗ 2 unused package(s) found:

    • Newtonsoft.Json 13.0.3
      No namespace from this package appears in any using directive
    • Serilog.Sinks.File 5.0.0
      No namespace from this package appears in any using directive

  Run 'slimdep fix <project>' to remove them automatically.

Scanning MyApp.Core.csproj ...

  ✓ All packages are used. Nothing to remove.

Sample JSON output (--format json):

{
  "projectPath": "C:\\Dev\\MySolution\\src\\MyApp.Api\\MyApp.Api.csproj",
  "totalDirectPackages": 8,
  "unusedCount": 2,
  "durationMs": 142.35,
  "unusedPackages": [
    {
      "name": "Newtonsoft.Json",
      "version": "13.0.3",
      "reason": "No namespace from this package appears in any using directive"
    },
    {
      "name": "Serilog.Sinks.File",
      "version": "5.0.0",
      "reason": "No namespace from this package appears in any using directive"
    }
  ]
}

Exit codes: 0 = all clean · 1 = unused packages found · 2 = error


slimdep fix — Remove unused packages

slimdep fix <project> [options]

Argument

Argument Description
<project> Path to a .csproj file or a folder (all .csproj files found recursively, obj/ excluded)

Options

Option Default Description
--dry-run off Preview removals — no files written
--include-transitive off Also remove unused transitive packages
-?, -h, --help Show help

Examples:

# Always preview first
slimdep fix C:\Dev\MySolution --dry-run

# Remove unused packages from all projects in a folder
slimdep fix C:\Dev\MySolution

# Single project
slimdep fix MyApp.csproj

# Include transitive packages
slimdep fix MyApp.csproj --include-transitive

Sample output:

Found 2 project(s).

Scanning MyApp.Api.csproj ...
  Unused packages (2):
    - Newtonsoft.Json 13.0.3
    - Serilog.Sinks.File 5.0.0
  Removed 2 package(s) from MyApp.Api.csproj.

Scanning MyApp.Core.csproj ...
  No unused packages found.

Run 'dotnet restore' to update the lockfile.

After fixing, run:

dotnet restore

Help

slimdep --help
slimdep scan --help
slimdep fix --help

CI Pipeline Integration

scan exits with code 1 when unused packages are found — drop it straight into any pipeline:

GitHub Actions:

- name: Check for unused NuGet packages
  run: slimdep scan .

Azure DevOps:

- script: slimdep scan .
  displayName: 'SlimDep: Check unused packages'

Supported Features

Feature Status
Scan a single .csproj file
Scan a folder recursively (finds all .csproj files)
Automatically skip obj/ folders during recursive search
Console output (human-readable with ✓/✗ indicators)
JSON output (--format json)
Write report to a file (--output)
Detect unused direct package references
Detect unused transitive (indirect) package references (--include-transitive)
Skip packages with no exported namespaces (build tools, source generators)
Auto-remove unused packages from .csproj (fix command)
Dry-run mode — preview removals without writing (--dry-run)
CI-friendly exit codes (0 = clean, 1 = unused found, 2 = error)
Multi-project fix in a single command
Roslyn syntax-only analysis (no build required)
Namespace-level matching via DLL reflection metadata
In-process namespace cache (fast repeated scans)

Prerequisites

  • .NET 8 SDK or later (.NET 8, 9, or 10)
  • Target project must be restored (dotnet restore) so that obj/project.assets.json exists

Limitations

  • Packages used via fully-qualified names (no using directive) are reported as unused
  • Does not analyse XAML, Razor, or other non-C# files
  • Requires obj/project.assets.json — run dotnet restore before scanning
  • Source generators and build-only packages (no exported namespaces) are automatically excluded

License

MIT © 2026 Vinay Diddi

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

This package has no dependencies.

Version Downloads Last Updated
1.0.0-preview.1 55 6/22/2026

Initial preview release.

- Detect unused NuGet package references via static source analysis (no build required)
- Recursive multi-project scanning — pass a folder and all .csproj files are found automatically
- JSON output format for CI pipeline integration
- slimdep fix command to automatically remove unused packages from .csproj files
- --dry-run support to preview changes before writing
- --include-transitive flag for transitive dependency analysis
- CI-friendly exit codes: 0 = clean, 1 = unused packages found, 2 = error