Repository navigation
06 Layer Farol.Engine Legacy and Packages
The Legacy Modernization and Packages subsystem provides automated tooling for assessing legacy .NET Framework applications, inspecting configurations safely, planning migrations to modern .NET, and evaluating NuGet package dependencies without hallucinations.
Farol.Engine (Legacy & Packages)
├── Legacy/
│ ├── LegacyInventory.cs # Comprehensive inventory of legacy technologies & hotspots
│ ├── ApiUsageScanner.cs # Scans semantic models for referenced legacy framework APIs
│ ├── ConfigInspector.cs # Web.config / app.config parser with secret masking
│ ├── PortabilityAnalyzer.cs # Evaluates API compatibility against target reference assemblies
│ ├── TargetSurface.cs # Loads targeting pack reference assemblies (net10.0, -windows)
│ ├── LegacyCatalog.cs # Knowledge base of legacy technologies and modern replacements
│ ├── MigrationPlanner.cs # Bottom-up topological migration plan generator
│ └── MigrationDocuments.cs # Markdown generator (assessment.md, plan.md, tasks.md)
└── Packages/
├── PackageInventory.cs # Direct & transitive package dependency analyzer
├── PackageApi.cs # Extracts public API signatures & XML docs from package binaries
├── PackageFeeds.cs # NuGet feed client (advisories, deprecations, newer versions)
├── PackageModels.cs # Package manifests, advisories, and API models
└── NuGetContext.cs # Discovers nuget.config, credential providers, and local caches
dotnet_legacy_inventory provides a comprehensive census of legacy technologies across the solution:
-
Project Formats: Classic
.csproj/.vbprojvs. SDK-style projects. -
Target Frameworks: Projects targeting .NET Framework (e.g.
v4.0–v4.8.1). -
Package Management: Projects using legacy
packages.configinstead ofPackageReference. -
Legacy Application Models:
- ASP.NET WebForms pages, user controls, and master pages (
.aspx,.ascx,.master,Global.asax). - ASMX Web Services (
.asmx) and WCF Services (.svc). - WinForms forms and user controls (detected via class inheritance).
- WPF XAML views and resources.
- ASP.NET WebForms pages, user controls, and master pages (
-
Problematic Legacy APIs (
ApiUsageScanner):-
BinaryFormatter(insecure serialization). -
System.Configuration.ConfigurationManager. -
System.WebAPIs (HttpContext, WebConfigurationManager). -
System.Runtime.Remoting.
-
- Legacy Hotspots: Identifies the specific source files with the highest concentration of legacy lines.
In .NET Framework systems, web.config and app.config files commonly hold sensitive production credentials alongside architectural settings.
A path argument also picks the workspace when the root holds no single solution and no workspace is given (AC-44), so a web.config is read from the solution that holds it.
ConfigInspector strictly masks credentials before returning configuration data to the agent:
- Passwords, keys and tokens inside connection strings are replaced with
***, keeping the rest readable. - App settings whose names look like credentials (password, secret, token, API or access key, credential, signature, connection string) are masked.
- Machine keys (
<machineKey>) are masked.
ConfigInspector automatically computes the equivalent modern appsettings.json representation:
- Converts flat XML
<appSettings>into nested JSON structures by splitting hierarchical keys (e.g.Smtp:Servermaps to{ "Smtp": { "Server": "..." } }). - Translates
<connectionStrings>into standard modern ASP.NET CoreConnectionStringsconfiguration objects.
Unlike naive regex-based migration tools, PortabilityAnalyzer checks code against actual reference assemblies of the target framework:
flowchart LR
SourceCode["Legacy Source Code"] --> SemanticModel["Semantic Model API Bindings"]
SemanticModel --> TargetSurface["TargetSurface (Reference Assemblies of net10.0 / -windows)"]
TargetSurface --> Missing{"Symbol exists in target?"}
Missing -- No --> ReportedMissing["Missing API (Will not compile on modern .NET)"]
Missing -- Yes --> Obsolete{"Marked [Obsolete]?"}
Obsolete -- Yes --> ReportedObsolete["Obsolete API (e.g. SYSLIB0011 BinaryFormatter)"]
Obsolete -- No --> Portable["Portable (Compiles cleanly)"]
-
Target Surface Loading (
TargetSurface): Loads the official .NET reference assemblies for the chosen target (default:net10.0). Projects using WinForms or WPF are evaluated against thenet10.0-windowstargeting pack. -
Missing vs. Obsolete Classification:
-
Missing: The type or member does not exist in modern .NET (e.g.
System.Web.UI.Page). -
Obsolete: The type exists but emits modern deprecation warnings (e.g.
SYSLIB0011forBinaryFormatter).
-
Missing: The type or member does not exist in modern .NET (e.g.
-
Actionable Replacements (
LegacyCatalog): Maps each identified issue to its official replacement (e.g.BinaryFormatter$\rightarrow$ System.Text.Json,ConfigurationManager$\rightarrow$ Microsoft.Extensions.Configuration).
dotnet_migration_plan synthesizes inventory and portability data into an actionable, step-by-step modernization strategy.
Projects are ordered by their dependency hierarchy:
-
Shared Class Libraries: Multi-target modern .NET (
net10.0) and legacy .NET Framework (net48). - Unit Test Projects: Modernize to execute against both frameworks.
-
Desktop Applications (WinForms / WPF): Retarget directly to
net10.0-windows. - Web Applications (WebForms / WCF / MVC 5): Structured incremental migration using ASP.NET Core, YARP (Yet Another Reverse Proxy), and System.Web adapters.
When write=true is specified, Farol saves structured documents under docs/modernization/:
-
assessment.md: High-level summary of solutions, target frameworks, and legacy inventory. -
plan.md: Step-by-step architectural migration sequence. -
tasks.md: Detailed markdown checklists referencing exactfile:linelocations. -
Checkbox State Preservation: If an agent or human marks a task as completed (
- [x]), regenerating the migration plan preserves the checked state.
dotnet_packages maps the package ecosystem across projects:
- Direct vs. Transitive Packages: Distinguishes direct references from transitive dependencies, displaying the exact chain that pulled each transitive package in.
-
Format Support: Evaluates both modern SDK-style PackageReferences (including Central Package Management via
Directory.Packages.props) and classicpackages.config. - Security & Deprecation Advisories: Asks the workspace's NuGet feeds, through the NuGet client (credential providers, HTTP cache, package source mapping), about known vulnerabilities, deprecation (with the recommended replacement) and newer versions.
-
Offline Mode (
--offline): When offline, queries the cached vulnerability data recorded during the last restore insideproject.assets.json.
To prevent LLM hallucinations when upgrading or consuming packages, dotnet_package_api extracts the verified public API surface:
-
Local-First Assembly Discovery:
Inspects the local NuGet cache (
%USERPROFILE%\.nuget\packages), fallback directories, or the solution'spackagesdirectory. If missing and not--offline, downloads the package into the global packages folder, the way restore does. - Roslyn Compilation against Runtime Metadata: Loads the package's assembly for the requested target framework into an in-memory Roslyn compilation backed by runtime framework assemblies.
-
Exact Signatures and XML Documentation:
Outputs exact type definitions, method signatures, parameter types, and XML documentation summaries from the package's
.xmlfile, giving the agent a definitive source of truth without guessing.
Welcome to the official technical documentation for Farol, an open-source Model Context Protocol (MCP) server that equips AI coding agents (Claude Code, GitHub Copilot, Google Antigravity, Cursor, Codex) with compiler-accurate understanding of C# and VB.NET solutions.
- Home — Project overview, value proposition, quickstart, and problem statement
- 01. Architecture & Design Philosophy — Layered architecture, snapshot isolation, BuildHost model, design rationale
- 02. Layer: Farol.Core — Zero-Roslyn foundation: path sandbox, process execution, diffing, atomic writes, privacy
- 03. Layer: Farol.Engine — Workspaces & Loading — MSBuildWorkspaceLoader, analyzer copies, Visual Studio toolchain probing, background warmup, file watcher
- 04. Layer: Farol.Engine — Navigation & Markup — Compiler-accurate navigation, symbol search, IOperation classification, WebForms & XAML indexers, decompilation
- 05. Layer: Farol.Engine — Verification & Testing — Diagnostic checks in about a second, baseline fingerprinting, edits during a load, edit impact analysis, Code Actions, build & test runners
- 06. Layer: Farol.Engine — Legacy Modernization & Packages — Legacy inventory, config inspector, target surface portability, migration planner, NuGet API inspector
- 07. Layer: Farol.Tools & MCP Contract — Comprehensive reference for all 23 MCP tools, 7 prompts, the skill resources and MCP tasks
- 08. Layer: Farol.Host & CLI — Stdio transport, stream isolation, configuration precedence, privacy-first usage telemetry
- 09. Integrations & Plugins — Claude Code plugin (hook & skill), Visual Studio 2026, Copilot, Antigravity, VS Code, NuGet distribution
- 10. Benchmarks & Evals — Performance benchmarks (Umbraco & DNN Platform), evaluation suite and Phase 2 round, compiler oracle
- 11. Phase 2: Refactorings, Analyzers, Loaders & Index — Refactoring write path, analyzers in checks, heuristic and binlog loaders, persistent index, structured output, MCP Registry
- 12. Phase 3: MCP Tasks & Skills — Build, test, load and convert as MCP tasks; the playbook as three skills served by the server; exit results