slnx-validator 0.2.0

dotnet tool install --global slnx-validator --version 0.2.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 slnx-validator --version 0.2.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=slnx-validator&version=0.2.0
                    
nuke :add-package slnx-validator --version 0.2.0
                    

slnx-validator

NuGet Security Rating Maintainability Rating Coverage

.slnx is the modern XML-based solution format introduced by Microsoft — and honestly, it's a great improvement over the old .sln format. It's human-readable, merge-friendly, and easy to edit by hand. 🎉

There's just one catch: neither Visual Studio, MSBuild, nor the dotnet CLI fully validates .slnx files. Invalid constructs are silently accepted, which can lead to confusing errors that are surprisingly hard to trace back to the solution file.

slnx-validator fills that gap. It catches the issues the toolchain quietly ignores. 🔍

You could read more about the .slnx at the official .NET blog post

Installation

dotnet tool install -g slnx-validator

slnx-validator runs on .NET 8, 9, and 10. Note that using .slnx files in your projects requires .NET SDK 9 or later — but your projects themselves can still target .NET 8.

Usage

Validate a single file:

slnx-validator MySolution.slnx

Validate all .slnx files in a folder:

slnx-validator src\

Validate using a wildcard pattern:

slnx-validator src\MyProject*.slnx

Validate multiple files, folders, or patterns at once (comma-separated):

slnx-validator "MySolution.slnx, src\*.slnx, other\"

Exit code 0 means everything is valid. Exit code 1 means one or more errors were found.

Example output

All valid ✅

slnx-validator MySolution.slnx
[OK]   MySolution.slnx

Errors found ❌

slnx-validator MySolution.slnx
[FAIL] MySolution.slnx

MySolution.slnx
  - line 5: [SLNX013] The element 'Folder' in namespace '...' has invalid child element 'Folder'. List of possible elements expected: 'Project'.
  - line 12: [SLNX011] File not found: docs\CONTRIBUTING.md

Multiple files — mixed results

slnx-validator src\
[OK]   src\Frontend.slnx
[FAIL] src\Backend.slnx

src\Backend.slnx
  - line 4: [SLNX011] File not found: docs\CONTRIBUTING.md
  - line 8: [SLNX012] Wildcard patterns are not supported in file paths: docs\*.md

What is validated

This tool checks what dotnet / MSBuild / Visual Studio does not validate by default:

  • XSD schema validation — verifies that the .slnx file conforms to the official Microsoft schema. Visual Studio silently accepts certain invalid constructs without showing any error — for example, a <Folder> nested inside another <Folder> (see examples/invalid-xsd.slnx).

  • Solution folder file existence — checks that every <File Path="..."> listed inside a <Folder> actually exists on disk.

  • Wildcard usage.slnx does not support wildcard patterns. Visual Studio silently accepts them but simply ignores the entries, so your files appear to be listed but are never actually resolved. slnx-validator catches this in <File Path="..."> entries (see examples/invalid-wildcard.slnx):

    
    <Folder Name="docs">
      <File Path="docs\*.md" />
    </Folder>
    

    Wildcard support is a known open request that was closed as not planned.

The following are intentionally out of scope because the toolchain already handles them:

  • Project file existence (<Project Path="...">) — dotnet build / MSBuild already reports missing project files.

Error codes

Code Name Description
SLNX001 FileNotFound The input .slnx file does not exist.
SLNX002 InvalidExtension The input file does not have a .slnx extension.
SLNX003 NotATextFile The file is binary and cannot be parsed as XML.
SLNX010 InvalidXml The file is not valid XML (see examples/invalid-not-xml.slnx).
SLNX011 ReferencedFileNotFound A file referenced in <File Path="..."> does not exist on disk.
SLNX012 InvalidWildcardUsage A <File Path="..."> contains a wildcard pattern (see examples/invalid-wildcard.slnx).
SLNX013 XsdViolation The XML structure violates the schema, e.g. <Folder> inside <Folder> (see examples/invalid-xsd.slnx).

XSD Schema

Microsoft doesn't provide much documentation for the .slnx format, but there is an XSD schema in the official vs-solutionpersistence repository — and it's enough to catch real structural problems before they cause trouble:

https://github.com/microsoft/vs-solutionpersistence/blob/main/src/Microsoft.VisualStudio.SolutionPersistence/Serializer/Xml/Slnx.xsd

Licensed under the MIT License — Copyright (c) Microsoft Corporation.

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 is compatible.  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 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
0.2.0 36 3/7/2026
0.1.0 34 3/6/2026

- Added logo
     - Shorter error codes