Evolver5 1.2.13
dotnet add package Evolver5 --version 1.2.13
NuGet\Install-Package Evolver5 -Version 1.2.13
<PackageReference Include="Evolver5" Version="1.2.13" />
<PackageVersion Include="Evolver5" Version="1.2.13" />
<PackageReference Include="Evolver5" />
paket add Evolver5 --version 1.2.13
#r "nuget: Evolver5, 1.2.13"
#:package Evolver5@1.2.13
#addin nuget:?package=Evolver5&version=1.2.13
#tool nuget:?package=Evolver5&version=1.2.13
C# Evolver
Advanced Roslyn-powered toolkit for semantic C# code transformation, intelligent refactoring, and automated code organization.
โจ Features
- Semantic Tree Model: Rich, strongly-typed representation of C# code using a custom
TreeNode<SemanticNode>hierarchy - Intelligent Merging: Merge partial classes, namespaces, and code from multiple sources while preserving semantics
- Interface Extraction: Automatically generate interfaces from classes with proper attributes and documentation
- Code Organization: Group members by kind, access modifier, and name for consistent, readable structure
- Extension Method Handling: Seamlessly convert between static helper classes and proper C# extension methods
- File Structure Tools: Split types into one-file-per-type or consolidate multiple files into a single semantic model
- Round-trip Safety: Full serialization/deserialization with compilation verification and CSharpier formatting
- Large Class Refactoring: Split oversized classes into partial implementations based on interfaces
- Self-hosting Tests: Includes comprehensive self-testing on its own codebase
๐ Table of Contents
- โจ Features
- ๐ Quick Start
- ๐ฆ Installation
- ๐ก Usage
- ๐ Tech Stack
- ๐ง Configuration
- ๐งช Testing / Development
- ๐ Deployment
- ๐ค Contributing
- ๐ License
- ๐ Acknowledgments
๐ Quick Start
git clone https://github.com/terrycode27/csharp-evolver.git
cd csharp-evolver
# Build the solution
dotnet build
# Run self-test (demonstrates all core capabilities)
dotnet run --project Evolver5
๐ฆ Installation
Prerequisites
- .NET 8.0 SDK or later
- Visual Studio 2022 (recommended for full Roslyn integration)
As a Library
dotnet add package CSharpEvolver
From Source
- Clone the repository
- Restore dependencies:
dotnet restore - Build the project:
dotnet build -c Release
Environment Variables
No environment variables are required for core functionality. The tool automatically detects the solution root.
๐ก Usage
Basic Example
using CSharpEvolver;
// Initialize entry point for a project
var entry = EntryPoint.Create("Evolver5");
// Extract interfaces from all classes
entry.ExtractInterfaces();
// Group code logically by kind, modifier, and name
entry.GroupByKindModifierName();
// Convert static helper methods into proper extension methods
entry.GroupStaticExtensionMethods();
Common Workflows
Consolidate multiple class files:
var entry = EntryPoint.Create("MyProject");
entry.MergeIntoOneFile("classes", "MyProject.cs");
Split a monolithic file into one type per file:
var entry = EntryPoint.Create("MyProject");
entry.SplitIntoOneTypePerFile("MyProject.cs", "classes");
Refactor a large class using interfaces:
var entry = EntryPoint.Create("MyProject");
entry.RefactorLargeClassIntoPartialsWithInterfaces("LargeService");
Round-trip test (parse โ transform โ verify):
var path = KnownProjectPaths.Evolver5;
path.TestSemanticSerializer();
path.GroupByKindModifierName();
Command Reference (via EntryPoint)
| Method | Purpose |
|---|---|
ExtractInterfaces() |
Generates I* interfaces from implementation classes |
GroupByKindModifierName() |
Organizes members consistently within types |
GroupStaticExtensionMethods() |
Converts static classes containing extensions |
SplitIntoOneTypePerFile() |
Creates clean one-type-per-file structure |
MergeIntoOneFile() |
Combines multiple files into semantic model |
ExtractFromNamespaces() |
Flattens namespaces for analysis |
MergeSelf() / MergeFrom() |
Smart merging of partial definitions |
๐ Tech Stack
- Language: C# 12
- Framework: .NET 8
- Compiler Platform: Microsoft.CodeAnalysis (Roslyn)
- Formatting: CSharpier (isolated assembly loading)
- JSON: Newtonsoft.Json
- Build: MSBuild + Microsoft.Build.Locator
- Architecture: Custom immutable-style semantic tree with extensive extension methods
๐ง Configuration
The toolkit is primarily code-driven. Key paths are defined in KnownProjectPaths:
public partial class KnownProjectPaths
{
public static EntryPoint Evolver5 => new("Evolver5");
}
For custom projects:
var entry = new EntryPoint("MyProjectName", @"C:\path\to\solution");
The project expects a standard structure:
MyProject/
โโโ MyProject.csproj
โโโ MyProject.cs # consolidated file
โโโ classes/ # one type per file
โโโ MyProject_test.cs
๐งช Testing / Development
# Run all self-tests
dotnet test
# Run specific semantic round-trip test
dotnet run --project Evolver5 --self-test
# Format all generated code
entry.Format();
Testing Capabilities Built-in:
- Round-trip verification (parse โ serialize โ compare)
- Compilation testing against original project
- Semantic equivalence checking
- CSharpier formatting validation
๐ Deployment
As a library, simply reference the compiled DLL or NuGet package.
For standalone use:
dotnet publish -c Release -r win-x64 --self-contained
The tool includes isolated loading of CSharpier to avoid Roslyn version conflicts, making it robust for deployment across different .NET environments.
๐ค Contributing
Contributions are welcome! This is a sophisticated code manipulation engine โ please:
- Discuss major changes via GitHub Issues first
- Maintain the high standard of semantic correctness
- Add or update self-tests when extending functionality
- Ensure all transformations pass compilation tests
See CONTRIBUTING.md for details.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Roslyn Team at Microsoft for the incredible compiler platform
- CSharpier for excellent code formatting
- The broader .NET community for inspiration in code generation tools
- All contributors who have helped evolve this codebase using itself
Need help or have a refactoring challenge? Open an issue on the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- LangChain.Providers.OpenRouter (>= 0.17.0)
- Microsoft.Build.Locator (>= 1.7.8)
- Microsoft.CodeAnalysis.Common (>= 5.0.0)
- Microsoft.CodeAnalysis.CSharp (>= 5.0.0)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 5.0.0)
- Microsoft.CodeAnalysis.Workspaces.MSBuild (>= 5.0.0)
- Microsoft.TeamFoundationServer.Client (>= 19.225.1)
- Microsoft.TeamFoundationServer.ExtendedClient (>= 19.225.1)
- Microsoft.VisualStudio.Services.Client (>= 19.225.1)
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 |
|---|---|---|
| 1.2.13 | 87 | 3/16/2026 |
| 1.2.10 | 75 | 3/16/2026 |
| 1.2.9 | 79 | 3/16/2026 |
| 1.2.8 | 73 | 3/16/2026 |
| 1.2.7 | 83 | 3/16/2026 |
| 1.2.6 | 77 | 3/15/2026 |
| 1.2.5 | 79 | 3/14/2026 |
| 1.2.4 | 79 | 3/13/2026 |
| 1.2.3 | 79 | 3/12/2026 |
| 1.2.2 | 87 | 3/11/2026 |
| 1.2.1 | 88 | 3/10/2026 |
| 1.2.0 | 70 | 3/10/2026 |
| 1.1.0 | 74 | 3/10/2026 |
| 0.1.0 | 81 | 3/10/2026 |
| 0.0.0-dev | 89 | 3/10/2026 |