Momentum.SourceGenerator 0.9.0

dotnet add package Momentum.SourceGenerator --version 0.9.0
                    
NuGet\Install-Package Momentum.SourceGenerator -Version 0.9.0
                    
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="Momentum.SourceGenerator" Version="0.9.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Momentum.SourceGenerator" Version="0.9.0" />
                    
Directory.Packages.props
<PackageReference Include="Momentum.SourceGenerator">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Momentum.SourceGenerator --version 0.9.0
                    
#r "nuget: Momentum.SourceGenerator, 0.9.0"
                    
#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 Momentum.SourceGenerator@0.9.0
                    
#: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=Momentum.SourceGenerator&version=0.9.0
                    
Install as a Cake Addin
#tool nuget:?package=Momentum.SourceGenerator&version=0.9.0
                    
Install as a Cake Tool

Momentum.SourceGenerator

The compile-time half of Momentum, an event-driven, multi-tenant workflow framework for .NET. From each [Step] class it generates:

  • minimal-API endpoints (API steps) with OpenAPI metadata
  • internal/external event handlers with execution recording
  • Quartz jobs (cron steps)
  • the per-assembly StepRegistration the runtime and test harness discover

This is a build-time-only dependency (DevelopmentDependency); it adds nothing to your runtime output. Diagnostics (MOM001–MOM019) surface step misconfigurations at compile time.

Install

dotnet add package Momentum.SourceGenerator

The package installs as a Roslyn analyzer and is marked as a development dependency; it does not become part of the application's runtime output. Add it to every project that declares [Step] classes.

Required step shape

using Momentum;

[Step]
public static partial class HealthStep
{
    public static ApiStepConfig Config => new()
    {
        Name = "Health",
        Path = "/health",
        Method = HttpVerb.Get
    };

    public static Task<StepResult> Execute() =>
        Task.FromResult<StepResult>(StepResult.Ok(new { status = "healthy" }));
}

The class must be static partial, and both Config and Execute must be public and static. Build diagnostics MOM001 through MOM019 identify invalid or unsafe definitions.

Troubleshooting

If generated members such as StepRegistration are missing:

  1. Check the build output for MOM0xx diagnostics.
  2. Confirm the generator package is referenced by the project containing the steps.
  3. Confirm the step class has the required shape shown above.
  4. Run dotnet build from the command line; restart the IDE language service after upgrading the generator if the IDE still shows stale output.

To inspect generated files, add this to the consuming project:

<PropertyGroup>
  <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
  <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)generated</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

Generated files then appear under obj/generated/Momentum.SourceGenerator/.

License

Momentum is free for qualifying non-commercial open-source projects. Commercial use requires a separate written license agreement. Generated output may be used under the terms described in the license included with the package.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.9.0 161 10/1/2026
0.8.2 175 9/13/2026
0.8.1 91 9/12/2026
0.8.0 101 9/12/2026
0.7.2 105 9/1/2026
0.7.1 117 8/28/2026