Momentum.SourceGenerator
0.9.0
dotnet add package Momentum.SourceGenerator --version 0.9.0
NuGet\Install-Package Momentum.SourceGenerator -Version 0.9.0
<PackageReference Include="Momentum.SourceGenerator" Version="0.9.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Momentum.SourceGenerator" Version="0.9.0" />
<PackageReference Include="Momentum.SourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Momentum.SourceGenerator --version 0.9.0
#r "nuget: Momentum.SourceGenerator, 0.9.0"
#:package Momentum.SourceGenerator@0.9.0
#addin nuget:?package=Momentum.SourceGenerator&version=0.9.0
#tool nuget:?package=Momentum.SourceGenerator&version=0.9.0
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
StepRegistrationthe 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:
- Check the build output for
MOM0xxdiagnostics. - Confirm the generator package is referenced by the project containing the steps.
- Confirm the step class has the required shape shown above.
- Run
dotnet buildfrom 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.
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.