DotnetUnused 1.2.3
dotnet tool install --global DotnetUnused --version 1.2.3
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local DotnetUnused --version 1.2.3
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DotnetUnused&version=1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package DotnetUnused --version 1.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dotnet Unused
A CLI tool for detecting unused code in .NET solutions using Roslyn static analysis.
Features
- Detects unused methods, properties, fields, and using directives
- Detects unused NuGet packages
- Auto-fix support for removing unused usings
- JSON export for CI/CD integration
- Works with .NET Core, .NET 5+, and .NET Framework
Installation
dotnet tool install --global dotnetunused
Or download standalone binaries from GitHub Releases.
Usage
dotnet-unused MySolution.sln
Options
| Option | Description |
|---|---|
--format, -f |
Output format: text or json (default: text) |
--output, -o |
Output file path (for JSON format) |
--exclude-public |
Exclude public members (default: true) |
--skip-usings |
Skip unused using directives analysis |
--fix |
Automatically remove unused usings |
--unused-packages |
Detect unused NuGet packages |
--help, -h |
Show command help |
Examples
# Basic analysis
dotnet-unused MySolution.sln
# Show CLI help
dotnet-unused --help
# Generate JSON report
dotnet-unused MySolution.sln --format json --output report.json
# Auto-fix unused usings
dotnet-unused MySolution.sln --fix
# Detect unused NuGet packages
dotnet-unused MySolution.sln --unused-packages
# Analyze single project
dotnet-unused MyProject.csproj
VS Code Extension
Install "Dotnet Unused" from the VS Code Marketplace for inline diagnostics and one-click fixes.
Requirements
- .NET 8.0 SDK or higher
- For .NET Framework projects: Visual Studio installation
License
See LICENSE file.
| 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 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.2.3 | 1,203 | 4/3/2026 |
| 1.2.2 | 130 | 4/3/2026 |
| 1.2.1 | 125 | 4/3/2026 |
| 1.2.1-ci0006 | 110 | 4/3/2026 |
| 1.2.1-ci0004 | 143 | 2/18/2026 |
| 1.2.0 | 950 | 12/31/2025 |
| 1.1.1-ci0001 | 122 | 12/30/2025 |
| 1.1.0 | 172 | 12/30/2025 |
| 1.0.5-ci0010 | 119 | 12/30/2025 |
| 1.0.5-ci0008 | 114 | 12/30/2025 |
| 1.0.4 | 164 | 12/28/2025 |
| 1.0.4-ci0015 | 122 | 12/28/2025 |
| 1.0.3 | 172 | 12/26/2025 |
| 1.0.2 | 162 | 12/26/2025 |
| 1.0.1 | 170 | 12/26/2025 |
| 1.0.0 | 172 | 12/26/2025 |
Initial release with support for detecting unused methods, properties, and fields.