AdventOfCode.Framework
2.6.2
dotnet add package AdventOfCode.Framework --version 2.6.2
NuGet\Install-Package AdventOfCode.Framework -Version 2.6.2
<PackageReference Include="AdventOfCode.Framework" Version="2.6.2" />
<PackageVersion Include="AdventOfCode.Framework" Version="2.6.2" />
<PackageReference Include="AdventOfCode.Framework" />
paket add AdventOfCode.Framework --version 2.6.2
#r "nuget: AdventOfCode.Framework, 2.6.2"
#:package AdventOfCode.Framework@2.6.2
#addin nuget:?package=AdventOfCode.Framework&version=2.6.2
#tool nuget:?package=AdventOfCode.Framework&version=2.6.2
Advent of Code Framework
C# framework to interactively bootstrap Advent of Code solutions.
Getting Started
The entry point to the framework is the AdventOfCodeRunner. From here you can either run in a full interactive mode
via AdventOfCodeRunner.Run or specify fixed options via methods like AdventOfCodeRunner.Solve. Solutions setup as
in Solutions will be picked up automatically, but the runner will guide through this.
Solutions
A Solution represents the logic to solve both problems for a particular puzzle day. Solutions should both implement
ISolution and be attributed with SolutionAttribute as follows:
[Solution(Day = 1)]
internal class SampleSolution : ISolution
{
/// <inheritdoc />
public string SolveProblem1(ProblemInput input, ISolutionLogger logger)
{
...
}
/// <inheritdoc />
public string SolveProblem2(ProblemInput input, ISolutionLogger logger)
{
...
}
}
The solution attribute can also be used to enable/disable a solution and mark it as solved to deprioritize it in lists.
Problems
Each solution has a 'solve' method for each problem, which can return a string answer to the problem, or null if the problem has not been solved.
Both the problem input and a logger are passed to the solve methods. The problem input can be consumed as either the raw string, the input lines or a matrix (if the input is of fixed width and height):
var inputRaw = input.Raw;
var inputLines = input.Lines;
var inputMatrix = input.Matrix;
Due to the interactive nature of the runner, writing to the console directly has undefined behaviour, whereas the logger is compatible with the interactive console.
Inputs and Answers
When a problem is run for the first time, input and answer files need to be provided. These are prompted for via Notepad by the runner, and the user is expected to save and exit Notepad to continue (similar to command line Git). Initially required files are the input and answer of the example part of the problem, plus the puzzle input (the files will indicate the data expected).
After running the solution to the main problem the option will be given to save the answer.
Inputs and answers will be persisted at %LocalAppData%\Advent of Code and can be edited there if they require
updating.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Humanizer.Core (>= 3.0.1)
- Spectre.Console (>= 0.54.0)
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 | |
|---|---|---|---|
| 2.6.2 | 235 | 12/6/2025 | |
| 2.6.1 | 226 | 12/6/2025 | |
| 2.6.0 | 228 | 12/6/2025 | |
| 2.5.2 | 206 | 12/5/2025 | |
| 2.5.1 | 204 | 12/5/2025 | |
| 2.5.0 | 218 | 12/3/2025 | |
| 2.4.1 | 438 | 11/30/2025 | |
| 2.4.0 | 424 | 11/30/2025 | |
| 2.3.0 | 755 | 11/30/2025 | |
| 2.2.0 | 693 | 11/30/2025 | |
| 2.1.0 | 689 | 11/30/2025 | |
| 2.0.0 | 765 | 11/30/2025 | |
| 1.3.8 | 528 | 12/14/2022 | |
| 1.3.2 | 439 | 12/13/2022 | |
| 1.3.0 | 652 | 12/11/2022 | |
| 1.2.1 | 463 | 12/8/2022 | |
| 1.1.2 | 471 | 12/3/2022 | |
| 1.1.1 | 448 | 12/3/2022 | |
| 1.1.0 | 451 | 12/3/2022 | |
| 1.0.0 | 447 | 12/2/2022 |