SlnEditor 7.2.0

dotnet add package SlnEditor --version 7.2.0                
NuGet\Install-Package SlnEditor -Version 7.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SlnEditor" Version="7.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SlnEditor --version 7.2.0                
#r "nuget: SlnEditor, 7.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SlnEditor as a Cake Addin
#addin nuget:?package=SlnEditor&version=7.2.0

// Install SlnEditor as a Cake Tool
#tool nuget:?package=SlnEditor&version=7.2.0                

SlnEditor

https://github.com/timabell/SlnEditor

This fork of https://github.com/wgnf/SlnParser/ adds write support, allowing a full round-trip of the sln file to disk or string.

Latest Release Downloads

Easy (to use) Editor for your .NET Solution (.sln) Files.

This project targets netstandard2.0 so it can basically be used anywhere you want.

License: MIT

The library is licensed under the MIT license.

Referenced nuget packages remain under their respective licenses.

The tests include an apache-2 licensed example sln which remains under that license.

💻 Usage

Modifying a sln

var solution = new Solution("path/to/your/solution.sln");
solution.Projects.Add(new SolutionFolder(name: "A Sln Folder")
{
    Files = new List<string> { "path/to/file.txt"},
    Projects = new List<IProject>
    {
        new Project("MyCode", "code.csproj", ProjectType.CSharp),
    },
};
var modifiedSln = solution.ToString();
File.WriteAllText("path/to/your/solution.sln", modifiedSln);

Accessing the projects


// gives you a flat list of all the Projects/Solution-Folders in your Solution
var flat = parsedSolution.AllProjects;

// gives you a structured (Solution-Folders containing projects) of all the Projects/Solution-Folders in your solution
var structured = parsedSolution.Projects;

// this'll give you all the projects that are not a Solution-Folder
var noFolders = parsedSolution
  .AllProjects
  .OfType<SolutionProject>();

// this'll give you all the projects of the desired type (C# class libs in this case)
var csharpProjects = parsedSolution
  .AllProjects
  .Where(project => project.Type == ProjectType.CSharpClassLibrary);

Other sln editing tools

dotnet sln

There's a dotnet new sln and dotnet sln which provides some create/edit capabilities - see https://andrewlock.net/creating-and-editing-solution-files-with-the-net-cli/

SlnTools

There's SlnTools https://www.nuget.org/packages/SLNTools.Core / https://github.com/mtherien/slntools

sln-items-sync

sln-items-sync uses this SlnEditor nuget package so might be a good example of using this library.

sln-items-sync is the reason this SlnEditor fork of SlnParser exists at all.

Stackoverflow

The usual host of people asking on stackoverflow, with mixed responses for this one.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SlnEditor:

Package Downloads
HybridCLR.QuickRun.Client

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.2.0 121 11/19/2024
7.1.0 5,621 5/24/2024
7.0.2 172 4/24/2024
7.0.1 144 2/14/2024
7.0.0 126 1/29/2024
6.1.2 129 1/17/2024
6.1.1 143 1/8/2024
6.1.0 187 1/3/2024
6.0.0 148 12/27/2023
5.0.1 126 12/24/2023
5.0.0 128 12/24/2023
4.1.0 113 12/22/2023
4.0.0 118 12/22/2023
3.0.0 142 12/22/2023
2.2.2 135 12/22/2023
2.2.1 146 12/16/2023
2.2.0 144 12/13/2023
2.1.1 142 12/11/2023
2.1.0 133 12/11/2023
1.1.0 128 12/11/2023
1.0.2 138 12/5/2023
1.0.1 146 12/5/2023
1.0.0 124 12/5/2023