SlnEditor 2.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SlnEditor --version 2.2.1                
NuGet\Install-Package SlnEditor -Version 2.2.1                
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="2.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SlnEditor --version 2.2.1                
#r "nuget: SlnEditor, 2.2.1"                
#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=2.2.1

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

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.

GitHub license Uses SemVer 2.0.0 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.

💻 Usage

Modifying a sln

var solution = new SolutionParser().Parse("path/to/your/solution.sln");
solution.Projects.Add(new SolutionFolder(Guid.NewGuid(), name: "foo-project", path: "foo/", typeGuid: new ProjectTypeMapper().ToGuid(ProjectType.Test), ProjectType.Test));
string modifiedSln = solution.Write();
File.WriteAllText("path/to/your/solution.sln", actual);

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.1.0 1,013 5/24/2024
7.0.2 165 4/24/2024
7.0.1 139 2/14/2024
7.0.0 121 1/29/2024
6.1.2 122 1/17/2024
6.1.1 138 1/8/2024
6.1.0 178 1/3/2024
6.0.0 143 12/27/2023
5.0.1 121 12/24/2023
5.0.0 123 12/24/2023
4.1.0 108 12/22/2023
4.0.0 113 12/22/2023
3.0.0 137 12/22/2023
2.2.2 128 12/22/2023
2.2.1 141 12/16/2023
2.2.0 133 12/13/2023
2.1.1 137 12/11/2023
2.1.0 128 12/11/2023
1.1.0 123 12/11/2023
1.0.2 133 12/5/2023
1.0.1 141 12/5/2023
1.0.0 117 12/5/2023