{"id":20152284,"url":"https://github.com/winscripter/slnx","last_synced_at":"2026-05-12T17:36:32.176Z","repository":{"id":235438470,"uuid":"790605109","full_name":"winscripter/Slnx","owner":"winscripter","description":"Fast \u0026 simple reader and writer for in-preview Visual Studio SLNX files","archived":false,"fork":false,"pushed_at":"2024-04-28T15:00:22.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-28T16:22:28.757Z","etag":null,"topics":["csharp","dotnet","sln","sln-files","sln-parser","slnx","slnx-parser","solution","visualstudio"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winscripter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-23T07:31:18.000Z","updated_at":"2024-06-23T11:31:50.508Z","dependencies_parsed_at":"2024-04-23T12:13:58.768Z","dependency_job_id":"1464b5ab-93ef-451c-b55c-b7f1b9c84429","html_url":"https://github.com/winscripter/Slnx","commit_stats":null,"previous_names":["winscripter/slnx"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FSlnx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FSlnx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FSlnx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winscripter%2FSlnx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winscripter","download_url":"https://codeload.github.com/winscripter/Slnx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241592299,"owners_count":19987332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","sln","sln-files","sln-parser","slnx","slnx-parser","solution","visualstudio"],"created_at":"2024-11-13T23:10:31.023Z","updated_at":"2026-05-12T17:36:32.145Z","avatar_url":"https://github.com/winscripter.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\r\n\u003e It is recommended to use an official library to work with SLNX files. See Microsoft.VisualStudio.SolutionPersistence\r\n\u003e on [NuGet](https://nuget.org/packages/Microsoft.VisualStudio.SolutionPersistence) or [GitHub](https://github.com/microsoft/vs-solutionpersistence).\r\n\u003e \r\n\r\n# Slnx\r\nSLNX is a fast parser and writer for the (currently) new in-preview Visual Studio XML Solution format with a .slnx extension, introduced in Visual Studio 2022 17.10 Preview 3.\r\n\r\nSlnx has been around since April 23, 2024 - days after SLNX file format was introduced.\r\n\r\nAvailable on NuGet: https://nuget.org/packages/Slnx\r\n\r\n### Reading\r\n\r\n```cs\r\nusing Slnx;\r\n\r\nvar model = SlnxModel.Load(File.ReadAllText(\"TestSlnx.txt\"));\r\n\r\nforeach (Folder folder in model.TopLevelFolders!)\r\n{\r\n    foreach (string file in folder.DescendantFiles!)\r\n    {\r\n        Console.WriteLine(file);\r\n    }\r\n}\r\n```\r\n\r\nTestSlnx.txt content:\r\n```\r\n\u003cSolution\u003e\r\n    \u003cFolder Name=\"Solution Items\"\u003e\r\n        \u003cFile Path=\"File1.cs\" /\u003e\r\n        \u003cFile Path=\".editorconfig\" /\u003e\r\n        \u003cProject Path=\"File.csproj\" /\u003e\r\n        \u003cFolder Name=\"Test\"\u003e\r\n            \u003cFile Path=\".editorconfig\" /\u003e\r\n            \u003cFile Path=\"data.cs\" /\u003e\r\n        \u003c/Folder\u003e\r\n    \u003c/Folder\u003e\r\n\u003c/Solution\u003e\r\n```\r\nOutput:\r\n```\r\nFile1.cs\r\n.editorconfig\r\n```\r\n\r\n### Writing (applies to Slnx 3.0)\r\n```cs\r\nusing Slnx;\r\nusing System.Text.Json;\r\n\r\n// Note: This is a .NET 8 project and uses Collection Expressions.\r\n\r\nvar factory = new SlnxFactory();\r\n\r\nvar folder = new Folder(\"Solution Items\");\r\nfolder.AddProjectWithPathOnly(\"./CSharp/CSharp.csproj\");\r\nfolder.AddProjectWithPathOnly(\"./VB.NET/VB.NET.vbproj\");\r\nfolder.AddProject(new Project(\"./DockerCompose/DockerCompose.dcproj\", type: Guid.NewGuid().ToString(), config: new(solution: \"*|*\", project: \"*|*|Deploy\")));\r\nvar moreFolders = new Folder(\"C++\");\r\nmoreFolders.AddFiles([\"util.cpp\", \"util.h\", \"data.cc\", \"data.h\"]);\r\nfolder.AddFiles([\"File1.cs\", \"File2.cs\"]);\r\nfolder.AddFolder(moreFolders);\r\n\r\nfactory.AddFolder(folder);\r\nfactory.AddProjectWithPathOnly(\"Slnx/Slnx.csproj\");\r\nfactory.AddProjectWithPathOnly(\"App/App.shproj\");\r\n\r\nstring content = factory.AsModel().Store();\r\nFile.AppendAllText(\"OutputSlnx.txt\", content);\r\n\r\n// To provide detailed information, I'll just JSONify it with System.Text.Json.\r\nvar model = SlnxModel.Load(File.ReadAllText(\"OutputSlnx.txt\"));\r\nConsole.WriteLine(JsonSerializer.Serialize(model));\r\n```\r\nThe program will generate a file named `OutputSlnx.txt` with these contents:\r\n\r\n```\r\n\u003cSolution\u003e\r\n    \u003cProject Path=\"Slnx/Slnx.csproj\" /\u003e\r\n    \u003cProject Path=\"App/App.shproj\" /\u003e\r\n    \u003cFolder Name=\"Solution Items\"\u003e\r\n        \u003cFile Path=\"File1.cs\" /\u003e\r\n        \u003cFile Path=\"File2.cs\" /\u003e\r\n        \u003cProject Path=\"./CSharp/CSharp.csproj\" /\u003e\r\n        \u003cProject Path=\"./VB.NET/VB.NET.vbproj\" /\u003e\r\n        \u003cProject Path=\"./DockerCompose/DockerCompose.dcproj\" Type=\"a9ca3494-2d8e-43aa-a418-28709ddb90fc\"\u003e\r\n            \u003cConfiguration Solution=\"*|*\" Project=\"*|*|Deploy\" /\u003e\r\n        \u003c/Project\u003e\r\n        \u003cFolder Name=\"C++\"\u003e\r\n            \u003cFile Path=\"util.cpp\" /\u003e\r\n            \u003cFile Path=\"util.h\" /\u003e\r\n            \u003cFile Path=\"data.cc\" /\u003e\r\n            \u003cFile Path=\"data.h\" /\u003e\r\n        \u003c/Folder\u003e\r\n    \u003c/Folder\u003e\r\n\u003c/Solution\u003e\r\n```\r\n\r\n# Contributing\r\nBug reports, feature suggestions, questions, and other feedback are welcome.\r\n\r\n# Compatibility\r\nSlnx uses the .NET 6.0 Runtime, but it works fine for preceding versions, including .NET 7.0, 8.0, and future releases.\r\n\r\n# Benchmarking\r\n\r\n## Read Benchmark\r\nInput:\r\n```xml\r\n\u003cSolution\u003e\r\n    \u003cFolder Name=\"Solution Items\"\u003e\r\n        \u003cFile Path=\"File1.cs\" /\u003e\r\n        \u003cFile Path=\".editorconfig\" /\u003e\r\n        \u003cProject Path=\"File.csproj\" /\u003e\r\n        \u003cFolder Name=\"Test\"\u003e\r\n            \u003cFile Path=\".editorconfig\" /\u003e\r\n            \u003cFile Path=\"data.cs\" /\u003e\r\n        \u003c/Folder\u003e\r\n    \u003c/Folder\u003e\r\n\u003c/Solution\u003e\r\n```\r\n\r\nBenchmark result:\r\n```\r\n\r\nBenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.2861/23H2/2023Update/SunValley3)\r\nAMD Ryzen 7 4700U with Radeon Graphics, 1 CPU, 8 logical and 8 physical cores\r\n.NET SDK 8.0.303\r\n  [Host]     : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2\r\n  DefaultJob : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2\r\n\r\n\r\n```\r\n| Method      | Mean     | Error     | StdDev    | Gen0   | Allocated |\r\n|------------ |---------:|----------:|----------:|-------:|----------:|\r\n| ReadBenchie | 4.486 μs | 0.0301 μs | 0.0267 μs | 7.1106 |  14.55 KB |\r\n\r\n## Write Benchmark\r\nCode:\r\n```cs\r\nvar factory = new SlnxFactory();\r\n\r\nvar folder = new Folder(\"Solution Items\");\r\nfolder.AddProjectWithPathOnly(\"./CSharp/CSharp.csproj\");\r\nfolder.AddProjectWithPathOnly(\"./VB.NET/VB.NET.vbproj\");\r\nfolder.AddProject(new Project(\"./DockerCompose/DockerCompose.dcproj\", type: null, config: new(solution: \"*|*\", project: \"*|*|Deploy\")));\r\nvar moreFolders = new Folder(\"C++\");\r\nmoreFolders.AddFiles([\"util.cpp\", \"util.h\", \"data.cc\", \"data.h\"]);\r\nfolder.AddFiles([\"File1.cs\", \"File2.cs\"]);\r\nfolder.AddFolder(moreFolders);\r\n\r\nfactory.AddFolder(folder);\r\nfactory.AddProjectWithPathOnly(\"Slnx/Slnx.csproj\");\r\nfactory.AddProjectWithPathOnly(\"App/App.shproj\");\r\n\r\n_ = factory.AsModel().Store();\r\n```\r\nTo provide the accurate benchmark, we're not saving or logging the result anywhere like console or file - we're\r\njust focusing on how fast Slnx can export the SlnxFactory instance as a string.\r\n\r\nBenchmark result:\r\n```\r\n\r\nBenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.2861/23H2/2023Update/SunValley3)\r\nAMD Ryzen 7 4700U with Radeon Graphics, 1 CPU, 8 logical and 8 physical cores\r\n.NET SDK 8.0.303\r\n  [Host]     : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2\r\n  DefaultJob : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2\r\n\r\n\r\n```\r\n| Method       | Mean     | Error     | StdDev    | Gen0   | Allocated |\r\n|------------- |---------:|----------:|----------:|-------:|----------:|\r\n| WriteBenchie | 4.841 μs | 0.0371 μs | 0.0310 μs | 9.4299 |  19.33 KB |\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinscripter%2Fslnx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinscripter%2Fslnx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinscripter%2Fslnx/lists"}