SlnEditor 7.1.0
dotnet add package SlnEditor --version 7.1.0
NuGet\Install-Package SlnEditor -Version 7.1.0
<PackageReference Include="SlnEditor" Version="7.1.0" />
paket add SlnEditor --version 7.1.0
#r "nuget: SlnEditor, 7.1.0"
// Install SlnEditor as a Cake Addin #addin nuget:?package=SlnEditor&version=7.1.0 // Install SlnEditor as a Cake Tool #tool nuget:?package=SlnEditor&version=7.1.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.
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.
- https://stackoverflow.com/questions/707107/parsing-visual-studio-solution-files
- https://stackoverflow.com/questions/8742316/how-to-create-visual-studio-solution-sln-files-programmatically-including-we
- https://stackoverflow.com/questions/2736260/programmatically-generate-visual-studio-solution
- https://stackoverflow.com/questions/14153614/how-to-generate-a-new-visual-studio-project-in-a-visual-studio-project-programma
Product | Versions 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. |
-
.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 |