Skip to content

sojohnnysaid/PackageAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

.NET Package Analyzer

A powerful command-line tool for analyzing NuGet packages and .NET assemblies using reflection. Quickly explore package contents, types, methods, and properties without writing code or digging through documentation.

Features

  • NuGet Package Analysis: Download and analyze any NuGet package directly by name
  • Local DLL Analysis: Inspect .dll files from your filesystem
  • Comprehensive Type Information: View all public types including classes, interfaces, enums, and structs
  • Member Details: See constructors, properties, methods, and events with clear formatting
  • Smart Dependency Resolution: Automatically resolves assembly dependencies
  • Beautiful Console Output: Color-coded output with intuitive icons for easy reading
  • Safe Inspection: Uses reflection without executing any code from analyzed packages

Installation

Prerequisites

  • .NET SDK 6.0 or later
  • Internet connection (for NuGet package analysis)

Clone and Build

git clone https://github.com/sojohnnysaid/PackageAnalyzer.git cd PackageAnalyzer dotnet build

Install as Global Tool (Coming Soon)

dotnet tool install -g PackageAnalyzer

Usage

Analyze a NuGet Package

dotnet run Newtonsoft.Json dotnet run Serilog dotnet run Microsoft.EntityFrameworkCore

Analyze a Local DLL

dotnet run /path/to/your/assembly.dll

Get Help

dotnet run help

Tips for Large Packages

For packages with extensive APIs, pipe the output to less for easier navigation:

dotnet run Microsoft.EntityFrameworkCore | less

Output Format

The analyzer uses icons and colors to make the output easy to understand:

Type Icons

  • πŸ“˜ Regular Class
  • πŸ”’ Static Class
  • 🎨 Abstract Class
  • πŸ”Œ Interface
  • πŸ“ Enum
  • πŸ“¦ Struct

Color Coding

  • Yellow: Constructors
  • Green: Properties
  • Cyan: Methods
  • Magenta: Events

Example Output

╔═══════════════════════════════════════════════════════════════╗ β•‘ πŸ“¦ PACKAGE: Newtonsoft.Json v13.0.3 β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• πŸ—‚οΈ Namespace: Newtonsoft.Json ──────────────────────────────────────────────────── πŸ“˜ JsonConvert (static class) Methods: β€’ static string SerializeObject(object value) β€’ static T DeserializeObject<T>(string value) β€’ static void PopulateObject(string value, object target) πŸ”Œ IJsonLineInfo (interface) Properties: β€’ int LineNumber { get; } β€’ int LinePosition { get; } Methods: β€’ bool HasLineInfo() 

How It Works

For NuGet Packages

  1. Creates a temporary .NET project
  2. Uses dotnet add package to download from NuGet
  3. Locates the package in the NuGet cache
  4. Finds the best matching framework version
  5. Loads assemblies using .NET Reflection
  6. Analyzes all public types and members
  7. Cleans up temporary files automatically

For Local DLLs

  1. Loads the assembly directly from the specified path
  2. Automatically resolves dependencies from:
    • Same directory as the DLL
    • NuGet cache for known packages
  3. Analyzes all public types and members

Supported Frameworks

The analyzer automatically selects the best framework version from the package, with preference for:

  • .NET 8.0
  • .NET 7.0
  • .NET 6.0
  • .NET 5.0
  • .NET Standard 2.1
  • .NET Standard 2.0
  • .NET Core 3.1

Use Cases

  • API Exploration: Quickly understand what a NuGet package offers
  • Dependency Analysis: See what types and methods are available in a library
  • Documentation Alternative: Get a quick overview when documentation is lacking
  • Learning Tool: Explore how popular packages are structured
  • Migration Planning: Understand APIs before upgrading package versions
  • Security Review: Inspect package contents without executing code

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

git clone https://github.com/sojohnnysaid/PackageAnalyzer.git cd PackageAnalyzer dotnet restore dotnet build

Running Tests

dotnet test

License

MIT License - see LICENSE file for details

Author

Created as a utility tool to help developers quickly explore .NET packages and assemblies.

Acknowledgments

  • Built with .NET reflection capabilities
  • Inspired by the need for quick package exploration tools
  • Thanks to the .NET community for feedback and suggestions

Future Enhancements

  • Export analysis results to JSON/XML
  • Filter by access modifiers (public, protected, etc.)
  • Search within package for specific types or methods
  • Compare two package versions
  • Generate markdown documentation from analysis
  • Support for analyzing multiple packages at once
  • Web-based UI for analysis results

About

A powerful CLI tool for analyzing NuGet packages and .NET assemblies using reflection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages