SlnEditor 7.0.2

dotnet add package SlnEditor --version 7.0.2
NuGet\Install-Package SlnEditor -Version 7.0.2
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.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SlnEditor --version 7.0.2
#r "nuget: SlnEditor, 7.0.2"
#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.0.2

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

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.2 79 4/24/2024
7.0.1 106 2/14/2024
7.0.0 88 1/29/2024
6.1.2 97 1/17/2024
6.1.1 111 1/8/2024
6.1.0 146 1/3/2024
6.0.0 116 12/27/2023
5.0.1 94 12/24/2023
5.0.0 96 12/24/2023
4.1.0 79 12/22/2023
4.0.0 83 12/22/2023
3.0.0 103 12/22/2023
2.2.2 96 12/22/2023
2.2.1 118 12/16/2023
2.2.0 103 12/13/2023
2.1.1 106 12/11/2023
2.1.0 95 12/11/2023
1.1.0 93 12/11/2023
1.0.2 104 12/5/2023
1.0.1 112 12/5/2023
1.0.0 94 12/5/2023