MvcStructureInspector 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global MvcStructureInspector --version 3.0.0
                    
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 MvcStructureInspector --version 3.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MvcStructureInspector&version=3.0.0
                    
nuke :add-package MvcStructureInspector --version 3.0.0
                    

MVC Structure Inspector

A Roslyn-powered .NET global CLI tool for static structural analysis of ASP.NET Core MVC projects.

NuGet License: MIT .NET Tests Product Page


Overview

MVC Structure Inspector performs deep Abstract Syntax Tree (AST) traversal of ASP.NET Core MVC projects using the .NET Compiler Platform (Roslyn). It produces comprehensive structural reports and gap analysis across:

  • C# source files — namespaces, classes, interfaces, structs, records, enums, delegates, fields, properties, constructors, methods, nested types, attribute metadata, lambda expressions, closures, and captured variable analysis
  • Razor views@model, @inject, @section, @RenderBody, <partial>, asp-for, ViewBag/ViewData, form actions, and tag helpers
  • Static assets — all files under wwwroot/ compared via SHA-256 content hashing
  • Project files.csproj properties, package references, project references, and .sln project registry
  • Snapshot-based drift detection — serialize a project baseline, then compare against a live project at any future point
  • Intelligent .gitignore generation — multi-ecosystem detection (15+ project types), nested/hybrid project awareness, safe merge, custom patterns

Installation

dotnet tool install --global MvcStructureInspector

Requirements: .NET 10.0 SDK or later · Windows / Linux / macOS


Commands

Inspect a Project

mvc-inspect <path>

Generates a full structural tree report with timestamped filename to prevent overwriting:

[OK] Report saved to:
     C:\source\MyApp\mvc-structure_20260306_064429.txt
     Snapshot: C:\source\MyApp\mvc-structure_20260306_064429.snapshot.json

A .snapshot.json file is automatically saved alongside the text report for future drift detection.

Gap Analysis Between Two Projects

mvc-inspect --compare <referenceProject> <targetProject>

Compares project [A] (reference) against project [B] (target) and produces a detailed gap report with:

  • Executive summary with quantified gap counts
  • Per-file, per-type, and per-member differential analysis
  • Razor view element-level comparison
  • Static asset (wwwroot) content comparison via SHA-256
  • Developer task checklist for alignment

Drift Detection from Saved Report

mvc-inspect --from-report <report.txt|.snapshot.json> <projectPath>

Loads a previously saved project snapshot as the baseline [A] and compares it against a live project [B]. This enables tracking structural drift over time without access to the original source.

Open an Existing Report

mvc-inspect open <report-file>

Opens any report file with the system default viewer.

Generate .gitignore

mvc-inspect gitignore <path>

Scans the project directory for all ecosystems and generates a comprehensive .gitignore:

  • 15+ project types: .NET, Node.js, Python, Rust, Go, Java, Ruby, PHP, Swift, Dart/Flutter, Unity, Terraform, Docker, Visual Studio, JetBrains
  • Nested/hybrid detection: automatically detects projects within projects (e.g., Node.js ClientApp/ inside a .NET solution)
  • Safety guarantee: never overwrites an existing .gitignore — creates .gitignore.generated_* instead
  • Merge mode: --merge appends only missing patterns to an existing .gitignore
  • Custom patterns: --add lets you specify additional patterns
  • Preview mode: --preview shows the output without writing any file
  Scanning: C:\source\MyApp
  Detected 3 ecosystem(s):
    • DotNet: 2 location(s)
        └─ . (via App.sln)
        └─ src (via Api.csproj)
    • NodeJs: 1 location(s)
        └─ ClientApp (via package.json)
    • Python: 1 location(s)
        └─ scripts (via requirements.txt)
  ⚠ 3 nested/hybrid project(s) detected — patterns applied globally.
[OK] .gitignore saved to:
     C:\source\MyApp\.gitignore

Self-Verification

mvc-inspect verify

Runs 32 automated checks across six categories — no access keys or credentials required:

  • Assembly Integrity — version metadata, SHA-256 hash, Roslyn dependency
  • Security Guard — protected extensions, output path guards, timestamped reports, gitignore validation
  • Runtime Compatibility — .NET version, UTF-8 encoding, SHA-256 crypto, file system access
  • Dependency Integrity — all referenced assemblies resolvable, Roslyn version compatible
  • File System Safety — system directory detection, temp access, path traversal guard
  • OS Kernel Diagnostics — 11 lambda-based probes (kernel version, process info, CPU count, architecture, uptime, GC memory, timezone, culture)

Version Information

mvc-inspect -v
mvc-inspect --version

Displays version, runtime, OS, and product links.


Options

Option Description
-v, --version Show version and build information
--out <file> Override the auto-generated output path
--open Open the report automatically after generation
--with-proj Include .csproj and .sln comparison (compare mode only)
--no-views Exclude .cshtml Razor view files
--cs-only Analyze C# source files only
--no-migrations Exclude the Migrations directory

Gitignore Options

Option Description
--preview Preview the generated .gitignore without writing to disk
--merge Merge with existing .gitignore (append only unique patterns)
--add <patterns> Add custom ignore patterns (e.g., --add "*.log" "tmp/" "secrets/")

Report Structure

Single Project Report (mvc-structure_*.txt)

MyMvcApp/
├── Controllers/
│   └── HomeController.cs
│       namespace: MyMvcApp.Controllers
│           + class HomeController : Controller
│               - ApplicationDbContext _context
│               + HomeController(ApplicationDbContext context)  [constructor]
│               + IActionResult Index()
│               + IActionResult About()
├── Models/
│   └── User.cs
│       namespace: MyMvcApp.Models
│           + class User
│               + int Id { get; set; }
│               + string Name { get; set; }
└── Views/
    └── Home/
        └── Index.cshtml
            Type: [View]
            @model MyMvcApp.Models.HomeViewModel
            Layout = "_Layout"
            asp-for="Name"

Gap Analysis Report (mvc-gap-report_*.txt)

The report contains six sections:

  1. Executive Summary — quantified gap counts across all categories
  2. C# File Gaps — missing, extra, or structurally modified source files
  3. Type & Member Differentials — class, interface, method, and property-level changes
  4. Static File Gaps — wwwroot content comparison with file sizes and SHA-256 hashes
  5. Project File Gaps.csproj property and package reference differentials, .sln project registry comparison
  6. Developer Task Checklist — actionable items to align project [B] with reference [A]

Security

  • Protected Extensions — the tool refuses to overwrite sensitive file types (.cs, .csproj, .sln, .json, .dll, .exe, .key, .pfx, etc.)
  • Timestamped Reports — automatic filenames with yyyyMMdd_HHmmss pattern prevent accidental overwrites
  • Gitignore Safety.gitignore generation never overwrites existing files; validates output paths stay within the project directory
  • CodeQL Scanning — every release undergoes automated static security analysis
  • SBOM Generation — CycloneDX Software Bill of Materials included with each release

Build from Source

git clone https://github.com/sbay-dev/mvc-inspect
cd mvc-inspect
dotnet build src/MvcStructureInspector.csproj -c Release
dotnet test tests/MvcStructureInspector.Tests/ -c Release
dotnet pack src/MvcStructureInspector.csproj -c Release -o nupkg/

Changelog

v3.0.0

  • Upgraded to .NET 10 / C# 14 / Roslyn 5.0.0
  • Delegate signature detection across all namespaces (ParsedDelegate record)
  • Lambda and closure analysis: expression bodies, captured variables, owner resolution (ParsedLambdaProperty record)
  • 11 OS kernel lambda probes: kernel version, process info, CPU count, 64-bit flags, machine name, user, uptime, working set, GC memory, timezone, culture
  • Self-verifier expanded to 32 checks across 6 categories (added OS Kernel Diagnostics)
  • GetKernelVersion() with OS-specific branches (Windows NT, Linux /proc/version, macOS Darwin)
  • 103 unit tests

v2.8.0

  • Version display via -v / --version with runtime, OS, and product metadata
  • Self-verification command (verify) with 21 automated checks across 5 categories
  • Assembly SHA-256 integrity hash for reproducibility verification
  • Roslyn dependency validation and runtime compatibility checks
  • SecurityGuard invariant verification (protected extensions, path guards, timestamps)
  • File system safety checks (system directory detection, path traversal)
  • No access keys or credentials required — fully local verification
  • 103 unit tests (10 new for self-verifier)

v2.7.0

  • Intelligent .gitignore generator with multi-ecosystem detection
  • 15+ project types: .NET, Node.js, Python, Rust, Go, Java, Ruby, PHP, Swift, Dart/Flutter, Unity, Terraform, Docker, Visual Studio, JetBrains
  • Nested/hybrid project awareness (e.g., Node.js inside .NET, Python scripts in a monorepo)
  • Safe merge mode with existing .gitignore (append unique patterns only)
  • Custom pattern support via --add flag
  • Preview mode via --preview flag
  • SecurityGuard: path-based gitignore write validation
  • 93 unit tests (22 new for gitignore generator)

v2.6.1

  • Professional NuGet metadata and product page integration
  • Comprehensive English documentation

v2.6.0

  • Snapshot-based drift detection via --from-report command
  • Automatic .snapshot.json serialization alongside text reports
  • SecurityGuard allowlist for tool-generated snapshot files

v2.5.0

  • wwwroot static file comparison with SHA-256 content hashing
  • Static file gap reporting (Section [4]) with file sizes and hash differentials
  • CI/CD pipeline: CodeQL, SBOM generation, automated NuGet publishing
  • Professional bilingual product page at sbay-dev.github.io/mvc-inspect

v2.4.0

  • .csproj and .sln comparison via --with-proj flag
  • Package reference, project reference, and SDK property differentials

v2.3.0

  • --open flag for automatic report viewing
  • open <file> subcommand for existing reports

v2.2.1

  • Timestamped auto-save filenames to prevent report overwriting

v2.0.0

  • Razor view structural analysis (.cshtml)
  • @model, @inject, @section, asp-for, <partial>, ViewBag/ViewData extraction

v1.0.0

  • Initial release — Roslyn-based C# structural inspection and gap analysis

License

MIT © 2025-2026 SBAY-SDK

Product Compatible and additional computed target framework versions.
.NET 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.

This package has no dependencies.

Version Downloads Last Updated
3.1.0 111 3/9/2026
3.0.1 86 3/8/2026
3.0.0 84 3/8/2026
2.8.0 88 3/8/2026
2.7.0 82 3/8/2026
2.6.1 84 3/6/2026
2.6.0 84 3/6/2026

v3.0.0: Upgraded to .NET 10 / C# 14 / Roslyn 5.0.0. Delegate signature detection and lambda/closure analysis with captured variable identification. OS kernel lambda probes (11 diagnostics). Self-verifier expanded to 32 checks across 6 categories. 103 unit tests.