.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
dotnet tool install -g slnx-validatorslnx-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.
Validate a single file:
slnx-validator MySolution.slnxValidate all .slnx files in a folder:
slnx-validator src\Validate using a wildcard pattern:
slnx-validator src\MyProject*.slnxValidate 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.
slnx-validator MySolution.slnx[OK] MySolution.slnx
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
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
This tool checks what dotnet / MSBuild / Visual Studio does not validate by default:
-
XSD schema validation — verifies that the
.slnxfile 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>(seeexamples/invalid-xsd.slnx). -
Solution folder file existence — checks that every
<File Path="...">listed inside a<Folder>actually exists on disk. -
Wildcard usage —
.slnxdoes 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-validatorcatches this in<File Path="...">entries (seeexamples/invalid-wildcard.slnx):<!-- ❌ Silently ignored by Visual Studio — no error, no files loaded --> <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.
| 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). |
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:
Licensed under the MIT License — Copyright (c) Microsoft Corporation.