<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Florin Vica</title>
    <description>The latest articles on DEV Community by Florin Vica (@florinvica).</description>
    <link>https://dev.to/florinvica</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3861033%2F81d03494-d8f8-4118-a656-f93eede16daa.jpeg</url>
      <title>DEV Community: Florin Vica</title>
      <link>https://dev.to/florinvica</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/florinvica"/>
    <language>en</language>
    <item>
      <title>I Built an MCP Server That Understands Your MSBuild Project Graph — Before You Build</title>
      <dc:creator>Florin Vica</dc:creator>
      <pubDate>Sat, 04 Apr 2026 19:25:32 +0000</pubDate>
      <link>https://dev.to/florinvica/i-built-an-mcp-server-that-understands-your-msbuild-project-graph-before-you-build-1pc8</link>
      <guid>https://dev.to/florinvica/i-built-an-mcp-server-that-understands-your-msbuild-project-graph-before-you-build-1pc8</guid>
      <description>&lt;p&gt;Ask your AI coding assistant about your .NET solution structure and watch it hallucinate. It'll guess at project references, miss TFM mismatches, and confidently tell you things that aren't true — because it has no way to actually &lt;em&gt;evaluate&lt;/em&gt; your MSBuild project files.&lt;/p&gt;

&lt;p&gt;Existing tools like BinlogInsights require you to build first, then analyze the binary log. That's useful, but it means you need a successful build before you can ask questions. What if your solution is broken? What if you just want to understand the dependency graph before a migration?&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/FlorinVica/msbuild-graph-mcp" rel="noopener noreferrer"&gt;MSBuild Graph MCP Server&lt;/a&gt; to fill this gap. It evaluates MSBuild project files directly — no build required — and exposes the results through 10 MCP tools that any AI assistant can call.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Does
&lt;/h2&gt;

&lt;p&gt;Install it as a .NET global tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; MsBuildGraphMcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then ask your assistant natural questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;"Show me the dependency graph for this solution"&lt;/em&gt; → full DAG with topological sort&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;"Are there any TFM mismatches?"&lt;/em&gt; → finds net6.0 projects referencing net8.0 libraries&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;"What breaks if I remove CoreLib?"&lt;/em&gt; → BFS traversal of all direct + transitive dependents&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;"Compare Debug vs Release"&lt;/em&gt; → property and package reference diffs&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;"Where does LangVersion come from?"&lt;/em&gt; → traces to Directory.Build.props, line 3&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  10 Tools, Grouped by Purpose
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Understand Structure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;analyze_solution&lt;/code&gt; — parse .sln, .slnx, .slnf with full project metadata&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_project_graph&lt;/code&gt; — dependency DAG, topological sort, graph metrics&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;find_shared_imports&lt;/code&gt; — Directory.Build.props/.targets discovery&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list_projects&lt;/code&gt; — fast listing, no MSBuild evaluation overhead&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Find Issues:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;detect_build_issues&lt;/code&gt; — TFM mismatches, orphans, circular deps, platform conflicts&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;check_package_versions&lt;/code&gt; — NuGet version consistency, CPM detection, VersionOverride&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analyze Impact:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;analyze_impact&lt;/code&gt; — "what breaks if I touch project X?"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_build_order&lt;/code&gt; — topological sort with critical path length&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Compare &amp;amp; Inspect:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;compare_configurations&lt;/code&gt; — diff any two build configurations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analyze_project_properties&lt;/code&gt; — property values with source file + line tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Plus &lt;strong&gt;2 guided prompts&lt;/strong&gt;: &lt;code&gt;project-health-check&lt;/code&gt; (scores your solution 1-10) and &lt;code&gt;migration-readiness&lt;/code&gt; (assesses .NET version upgrade feasibility).&lt;/p&gt;

&lt;h2&gt;
  
  
  We Predict. They Report.
&lt;/h2&gt;

&lt;p&gt;Every other MSBuild MCP server does &lt;strong&gt;post-build&lt;/strong&gt; analysis — they parse binary logs after compilation. That's retrospective. We do &lt;strong&gt;pre-build&lt;/strong&gt; analysis: evaluating project files directly through MSBuild's ProjectGraph API.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;MSBuild Graph MCP&lt;/th&gt;
&lt;th&gt;Binlog tools&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Requires build&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works on broken solutions&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dependency analysis&lt;/td&gt;
&lt;td&gt;Full DAG&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TFM compatibility checking&lt;/td&gt;
&lt;td&gt;Yes (NuGet.Frameworks)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Impact analysis&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Configuration diff&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This matters when you're planning a migration, onboarding to a large codebase, or debugging build issues in a solution that won't compile yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security: 15 Measures, Zero Side Effects
&lt;/h2&gt;

&lt;p&gt;All tools are &lt;strong&gt;read-only&lt;/strong&gt;. No builds triggered, no files modified, no network requests, no arbitrary commands.&lt;/p&gt;

&lt;p&gt;Highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Startup guard&lt;/strong&gt; blocks &lt;code&gt;MSBUILDENABLEALLPROPERTYFUNCTIONS&lt;/code&gt; — mitigates CVE-2025-21172 (property function RCE)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-evaluation XML scanner&lt;/strong&gt; detects &lt;code&gt;System.IO.File&lt;/code&gt;, &lt;code&gt;System.Net&lt;/code&gt;, &lt;code&gt;System.Diagnostics&lt;/code&gt; in project files &lt;em&gt;before&lt;/em&gt; MSBuild evaluates them&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IsBuildEnabled = false&lt;/strong&gt; on all ProjectCollection instances — prevents target execution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UNC path rejection&lt;/strong&gt;, extension whitelist, symlink detection, input length caps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error sanitization&lt;/strong&gt; strips user paths and stack traces from responses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allowed directories&lt;/strong&gt; via &lt;code&gt;MSBUILD_MCP_ALLOWED_PATHS&lt;/code&gt; environment variable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MSBuild property functions execute during evaluation by design — this is the same trust model as opening a project in Visual Studio. Only analyze projects you trust.&lt;/p&gt;

&lt;h2&gt;
  
  
  333 Tests, 8 Bugs Caught
&lt;/h2&gt;

&lt;p&gt;The test suite runs against &lt;strong&gt;real MSBuild APIs&lt;/strong&gt; — no mocks. A &lt;code&gt;TempSolutionBuilder&lt;/code&gt; fixture creates actual .sln/.slnx/.csproj files in temp directories for every test scenario.&lt;/p&gt;

&lt;p&gt;This approach caught 8 production bugs during development, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CircularDependencyException&lt;/code&gt; not being caught (MSBuild throws this separately from &lt;code&gt;MSB4251&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ToDictionary&lt;/code&gt; crash on duplicate PackageReferences (needed &lt;code&gt;GroupBy&lt;/code&gt; first)&lt;/li&gt;
&lt;li&gt;Resource leaks on exception paths (added &lt;code&gt;try/finally&lt;/code&gt; cleanup)&lt;/li&gt;
&lt;li&gt;Unbounded parallelism on 64-core machines (capped at 8)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All 333 tests pass in ~12 seconds on CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Install:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet tool &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; MsBuildGraphMcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Claude Desktop&lt;/strong&gt; — add to &lt;code&gt;claude_desktop_config.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"msbuild-graph"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"msbuild-graph-mcp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;VS Code&lt;/strong&gt; — add to &lt;code&gt;.vscode/mcp.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"servers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"msbuild-graph"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"stdio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"msbuild-graph-mcp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Claude Code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add msbuild-graph &lt;span class="nt"&gt;--&lt;/span&gt; msbuild-graph-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also works with &lt;strong&gt;Cursor&lt;/strong&gt;, &lt;strong&gt;Windsurf&lt;/strong&gt;, and &lt;strong&gt;Visual Studio 2026 Preview&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Requires .NET SDK 8.0+ and Windows (MSBuildLocator discovers VS/.NET SDK installations).&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install with &lt;code&gt;dotnet tool install -g MsBuildGraphMcp&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Point your AI assistant at a .NET solution&lt;/li&gt;
&lt;li&gt;Ask: &lt;em&gt;"Run a project health check on this solution"&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The &lt;code&gt;project-health-check&lt;/code&gt; prompt runs all 10 tools and produces a scored report with actionable recommendations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/FlorinVica/msbuild-graph-mcp" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nuget.org/packages/MsBuildGraphMcp" rel="noopener noreferrer"&gt;NuGet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MIT licensed. Contributions welcome.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>mcp</category>
      <category>ai</category>
      <category>msbuild</category>
    </item>
  </channel>
</rss>
