MvcStructureInspector 2.6.1

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

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, and attribute metadata
  • 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

Installation

dotnet tool install --global MvcStructureInspector

Requirements: .NET 8.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.


Options

Option Description
--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

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

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

v2.6.1: Professional NuGet metadata, product page URL, snapshot-based drift detection (--from-report), wwwroot static file comparison with SHA-256 hashing, 71 unit tests.