Kanject.Core.Features.Annotations.Attributes 3.13.1

Prefix Reserved
dotnet add package Kanject.Core.Features.Annotations.Attributes --version 3.13.1
                    
NuGet\Install-Package Kanject.Core.Features.Annotations.Attributes -Version 3.13.1
                    
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="Kanject.Core.Features.Annotations.Attributes" Version="3.13.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kanject.Core.Features.Annotations.Attributes" Version="3.13.1" />
                    
Directory.Packages.props
<PackageReference Include="Kanject.Core.Features.Annotations.Attributes" />
                    
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 Kanject.Core.Features.Annotations.Attributes --version 3.13.1
                    
#r "nuget: Kanject.Core.Features.Annotations.Attributes, 3.13.1"
                    
#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 Kanject.Core.Features.Annotations.Attributes@3.13.1
                    
#: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=Kanject.Core.Features.Annotations.Attributes&version=3.13.1
                    
Install as a Cake Addin
#tool nuget:?package=Kanject.Core.Features.Annotations.Attributes&version=3.13.1
                    
Install as a Cake Tool

Kanject.Core.Features.Annotations.Attributes

The attribute and enum types for Kanject edition-locking: [EditionLadder], [LockedBehind], [PrunedBelow], [EntitlementClaims], [Claim], FeatureBinding, and LockedServiceLifetime. They are marker types only — no implementation and no dependencies. All behavior comes from the source generators in Kanject.Core.Features.Annotations.

Installation

Most projects never reference this package directly: Kanject.Core.Features.Annotations depends on it, so installing the generator brings the attributes along.

<ItemGroup>
  <PackageReference Include="Kanject.Core.Features" />
  <PackageReference Include="Kanject.Core.Features.Annotations" PrivateAssets="all" />
</ItemGroup>

dotnet add package writes an IncludeAssets line for Kanject.Core.Features.Annotations that omits compile. Delete that line (keep PrivateAssets="all") — otherwise the attribute types from this package can be stripped from compilation.

Reference it directly when a project needs the attribute types in its compilation without relying on the generator package's dependency — for example, when your tooling insists on that IncludeAssets line:

dotnet add package Kanject.Core.Features.Annotations.Attributes

Targets netstandard2.0, .NET 8, .NET 9 and .NET 10 (netstandard2.0 lets the generators, which run inside the compiler, load the same types).

The attributes do nothing on their own. The edition attributes are acted on only by the generator running in the same assembly as the [EditionLadder] enum; applying them in a library that has no ladder (or no generator) produces no registrations, prune points, or manifest.

Quick start

using Kanject.Core.Features.Annotations.Attributes;
using Kanject.Core.Features.Annotations.Attributes.Enums;
using Kanject.Core.Features.Interfaces;

[EditionLadder]
public enum Edition { Free, Pro, Enterprise }

// Registered by the generated AddLockedFeatures() only in Pro and Enterprise builds.
[LockedBehind(Edition.Pro, Lifetime = LockedServiceLifetime.Singleton)]
[PrunedBelow(Edition.Pro)]
public sealed class AdvancedExportEngine : IExportEngine { /* ... */ }

public sealed partial class Dashboard
{
    private readonly IFeatureGate _gate;
    public Dashboard(IFeatureGate gate) => _gate = gate;

    // Decided at run time through IFeatureGate.
    [LockedBehind("beta.export", Fallback = nameof(Locked))]
    public partial string Render();

    // Present in every edition, gated on the "Edition.Pro" feature key.
    [LockedBehind(Edition.Pro, Binding = FeatureBinding.Runtime)]
    public partial string RenderUpsell();

    private string RenderCore() => "high-res export";
    private string RenderUpsellCore() => "Pro dashboard";
    private string Locked() => "Upgrade to export.";
}

The Dashboard guards need the runtime package Kanject.Core.Features (for IFeatureGate) and the generator package to supply the method bodies.

Attributes

All attributes are in the Kanject.Core.Features.Annotations.Attributes namespace.

Attribute Applies to Purpose
[EditionLadder] enum Marks the enum that defines the edition ladder. Member declaration order is the unlock order; the build's edition is chosen with <KanjectEdition>. One per assembly.
[LockedBehind(object edition)] class, method Compile-time lock behind an edition value, e.g. Edition.Pro. On a class: registered only in unlocking editions. On an implicitly private partial void: implemented only in unlocking editions, elided below.
[LockedBehind(string feature)] method Runtime lock behind a named feature flag resolved through IFeatureGate. The method must be partial (or use the generator's interceptor mode). On a class it is rejected (KANFL009).
[PrunedBelow(object edition)] class, struct, enum, interface, method, property, field Asserts the element is absent from artifacts built below edition and present at or above it; checked after publish when <VerifyEditionPruning> is on.
[EntitlementClaims] class, struct Marks a partial type as a license-claims holder; the generator emits a static FromClaimsJson(string?) parser.
[Claim(string key)] property Binds a property of an [EntitlementClaims] type to a claim key (Key). Supported types: int, long, bool, string, ImmutableArray<string>.

LockedBehind named properties

Property Type Default Meaning
Lifetime LockedServiceLifetime Scoped DI lifetime when a locked service class is registered. Ignored by the method forms.
Fallback string? null Name of a signature-compatible instance method called when a runtime lock is disabled. When unset, a disabled call throws FeatureLockedException.
Binding FeatureBinding CompileTime For the edition form: Runtime keeps the capability present in every edition and gates it through IFeatureGate on the key "{EnumName}.{Member}" (e.g. "Edition.Pro"). Ignored by the string-flag form.

Enums

In the Kanject.Core.Features.Annotations.Attributes.Enums namespace.

Enum Members Purpose
FeatureBinding CompileTime, Runtime How an edition-valued [LockedBehind] binds: pruned from lower editions, or present everywhere and gated at run time.
LockedServiceLifetime Scoped, Singleton, Transient DI lifetime for a locked service registration. Kanject-local so this package stays dependency-free.
Package Role Availability
Kanject.Core.Features.Annotations The generators, analyzers, and MSBuild targets that act on these attributes. nuget.org
Kanject.Core.Features Runtime: IFeatureGate, stock gates, FeatureKey, FeatureLockedException, DI helpers. nuget.org
Kanject.Core.Features.Entitlements Signed entitlement tokens whose claims feed [EntitlementClaims] parsers. Commercial license (not on nuget.org)

License

Licensed under the Kanject Code Libraries License Agreement (KCLLA); the full text ships in this package as LICENSE.md. Organizations whose trailing-twelve-month gross revenue and total funding raised are each below US$250,000 may use it at no cost under the Free Tier. At or above either threshold a commercial license is required — contact commercial@kanjectbusiness.com.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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 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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Kanject.Core.Features.Annotations.Attributes:

Package Downloads
Kanject.Core.Features.Annotations

Roslyn source generators + analyzers for Kanject feature-locking / editioning — emits the Editions.Has* constants, AddLockedFeatures() registration, runtime method guards, edition prune points, the [PrunedBelow] manifest, entitlement-claim parsers, and the LockedReference / publish-guard / pruning-verification MSBuild machinery.

Kanject.Core.Features

Kanject Core Features — the runtime seam for edition-locking and runtime feature gates: IFeatureGate, the in-memory/delegate gates, FeatureKey, the DI registration extensions, and the FeatureLocked diagnostics. Pairs with the Kanject.Core.Features.Annotations source generators. Crypto-free and first-class AOT.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.13.1 162 9/27/2026
3.13.0 134 9/27/2026
3.12.7 135 9/26/2026
3.12.6 158 9/7/2026
3.12.5 135 8/27/2026
3.12.4 136 8/22/2026
3.12.3 152 8/10/2026
3.12.2 136 8/9/2026
3.12.1 138 8/5/2026
3.12.0 150 8/5/2026
3.11.0 157 8/3/2026
3.10.5 156 7/30/2026
3.10.4 173 7/18/2026
3.10.3 172 7/13/2026
3.10.2 154 7/11/2026
3.10.1 166 7/11/2026
3.10.0 164 7/9/2026
3.9.1 150 7/9/2026