AdventOfCode.Framework
1.1.0
See the version list below for details.
dotnet add package AdventOfCode.Framework --version 1.1.0
NuGet\Install-Package AdventOfCode.Framework -Version 1.1.0
<PackageReference Include="AdventOfCode.Framework" Version="1.1.0" />
<PackageVersion Include="AdventOfCode.Framework" Version="1.1.0" />
<PackageReference Include="AdventOfCode.Framework" />
paket add AdventOfCode.Framework --version 1.1.0
#r "nuget: AdventOfCode.Framework, 1.1.0"
#:package AdventOfCode.Framework@1.1.0
#addin nuget:?package=AdventOfCode.Framework&version=1.1.0
#tool nuget:?package=AdventOfCode.Framework&version=1.1.0
Advent of Code Framework
Simple framework to bootstrap Advent of Code solutions.
Modes
The framework supports two run modes:
Solve Mode
Runs solutions and outputs the result from the problems.
Benchmark Mode
Benchmarks solution problems.
Setup
The entry point to the framework is the SolutionRunner.
SolutionRunner runner = new();
The SolutionRunner itself takes an optional argument which specifies a subdirectory which contains the input files. If specified, relative paths from a SolutionInput attribute will be resolved relative to this directory.
You can then run the solution runner directly in one of the two modes:
runner.Solve(1);
runner.Benchmark();
Extra arguments can be passed to restrict the runs (ie. to specific days or problems).
There is also an option intended to work with the command line:
runner.Run(args);
The arguments passed to Run can define the two modes as follows:
run <day> [problem]
benchmark [day] [problem]
for example:
runner.Run(new string[] { "run", "1", "1" });
Solutions
A solution needs to satisfy four constrains: inheriting from Solution, having a constructor which takes in a single parameter of type Input, having a single Solution attribute, and having at least one SolutionInput attribute.
A solution should then look something like this:
using AdventOfCode.Framework;
[Solution(1)]
[SolutionInput("Input.txt")]
public class MySolution : Solution
{
public MySolution(Input input) : base(input)
{
}
protected override string Problem1()
{
}
protected override string Problem2()
{
}
}
The solutions to the problems should be returned from Problem1 and Problem2 as strings.
Input
Input is read by the framework and can be accessed in the solution via the Input property (or directly in the constructor).
Process
Each problem run instantiates a new solution, so state can't be shared between runs. Benchmarking includes the runtime of the constructor as well as the specific problem, however it doesn't include reading input files.
Disabling Solutions, Problems and Inputs
Solutions can be disabled by passing in false to the Solution attribute, which means it will be ignored for runs and benchmarks. This is also the case with inputs which can be disabled via the SolutionInput attribute:
[Solution(1, Enabled = true)]
[SolutionInput("Input1.test.txt", Enabled = false)]
[SolutionInput("Input1.txt")]
public class MySolution : Solution
A problem that throws a NotImplementedException is not considered as having failed and therefore will not contribute to the benchmarks, or stop the current run.
Pitfalls
Input file paths should be specified relative to the output directory (or usually relative to the project root). For this to work the files need to be setup to copy over when building (https://social.technet.microsoft.com/wiki/contents/articles/53248.visual-studio-copying-files-to-debug-or-release-folder.aspx).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. net9.0 was computed. 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. |
-
net6.0
- No dependencies.
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 | 227 | 12/6/2025 | |
| 2.6.0 | 229 | 12/6/2025 | |
| 2.5.2 | 206 | 12/5/2025 | |
| 2.5.1 | 204 | 12/5/2025 | |
| 2.5.0 | 219 | 12/3/2025 | |
| 2.4.1 | 439 | 11/30/2025 | |
| 2.4.0 | 424 | 11/30/2025 | |
| 2.3.0 | 755 | 11/30/2025 | |
| 2.2.0 | 694 | 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 | 472 | 12/3/2022 | |
| 1.1.1 | 448 | 12/3/2022 | |
| 1.1.0 | 451 | 12/3/2022 | |
| 1.0.0 | 447 | 12/2/2022 |