Regira-Packages

Regira System — Project Files

Reading and manipulating .csproj files with Regira.System.Projects.


Parse, inspect, and update .csproj files programmatically. Useful for tooling, code-gen scripts, and build automation.

ProjectParser

var parser = new ProjectParser();

XDocument xml = XDocument.Load("MyLib.csproj");
Project proj  = parser.Parse(xml);

Console.WriteLine(proj.Id);               // PackageId
Console.WriteLine(proj.Version);          // "5.0.3"
Console.WriteLine(string.Join(", ", proj.TargetFrameworks!)); // "net8.0, net10.0"

Update and write back:

proj.Version = new Version("5.1.0");
XDocument updated = parser.Update(xml, proj);
updated.Save("MyLib.csproj");

ProjectService

// ITextFileService comes from the Regira.IO.Storage package
var service = new ProjectService(parser, textFileService);

Project       single  = await service.Details("src/MyLib/MyLib.csproj");
IEnumerable<Project> all = await service.List();     // scans root recursively

await service.Save(proj);   // writes changes back to disk

ProjectManager + ProjectTree

Build a dependency tree from all projects in the solution:

var manager = new ProjectManager(projectService);
ProjectTree tree = await manager.BuildTree();

// tree is a TreeList<Project> — see TreeList docs for navigation
var roots = tree.Roots;                              // projects with no dependencies
var leaves = tree.GetBottom().Select(n => n.Value.Id);  // projects nobody depends on

ProjectTree extends TreeList<Project> — see TreeList docs for the full navigation API.


Overview

  1. Index — Overview, projects, and installation
  2. Process Execution — Running commands and executables, capturing their output
  3. HostingWebHostOptions, background task queues, Windows Service installer
  4. Project Files — Parsing and managing .csproj files

License

Apache License 2.0 — this package contains no license validation and no runtime limits. See LICENSE. A few companion packages are commercially licensed with a free tier; see the licensing overview.