Evolver5 1.2.13

dotnet add package Evolver5 --version 1.2.13
                    
NuGet\Install-Package Evolver5 -Version 1.2.13
                    
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="Evolver5" Version="1.2.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Evolver5" Version="1.2.13" />
                    
Directory.Packages.props
<PackageReference Include="Evolver5" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Evolver5 --version 1.2.13
                    
#r "nuget: Evolver5, 1.2.13"
                    
#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.
#:package Evolver5@1.2.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Evolver5&version=1.2.13
                    
Install as a Cake Addin
#tool nuget:?package=Evolver5&version=1.2.13
                    
Install as a Cake Tool

C# Evolver

Advanced Roslyn-powered toolkit for semantic C# code transformation, intelligent refactoring, and automated code organization.

GitHub stars License .NET Roslyn

โœจ 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

๐Ÿš€ 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

  1. Clone the repository
  2. Restore dependencies:
    dotnet restore
    
  3. 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:

  1. Discuss major changes via GitHub Issues first
  2. Maintain the high standard of semantic correctness
  3. Add or update self-tests when extending functionality
  4. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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