Kanject.Core.Packages.Annotations.Attributes 3.13.0

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

Kanject.Core.Packages.Annotations.Attributes

The attribute types for the Kanject package manager: [Package], [PackageProvider], [PackageResolverKey], [DefaultPackageProvider], [ProviderAggregator] and friends, plus the PackageLifetime enum. It contains marker types only, with no behavior. The source generator in Kanject.Core.Packages.Annotations reads these attributes and emits package managers, resolvers, and keyed DI registrations from them.

Most projects never reference this package directly. It is a dependency of Kanject.Core.Packages.Annotations, so installing the generator brings it in.

Installation

Usually you install the generator and get this package transitively:

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

dotnet add package Kanject.Core.Packages.Annotations writes an IncludeAssets line 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 you want the attribute types compile-visible no matter how the generator is referenced:

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

Targets netstandard2.0, .NET 8, .NET 9 and .NET 10. The netstandard2.0 build is what the Roslyn generator loads; your application uses the .NET 8+ builds.

Attributes

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

Attribute Target Purpose
[Package(string id, string? description = null)] Interface Declares a package port. The id (e.g. "payment.gateway") names the package and drives generated type names (IPaymentGatewayPackageManager).
[Package<TPackage>] Class Declares that a provider class belongs to the TPackage port.
[PackageProvider(string id, int version)] Class Identifies a provider and its version. Optional Lifetime named argument sets the keyed DI lifetime (default PackageLifetime.Scoped).
[PackageProvider<TPackageProvider>] Class On a [ProviderAggregator] class, lists a provider to fan out to. Repeatable.
[PackageResolverKey(string key)] Class Short dispatch key for a provider (e.g. "stripe"). Without it, the provider id is the key. Providers may share a key if their versions differ.
[DefaultPackageProvider] Class Marks the provider returned by GetDefaultPackage(). At most one per package.
[PackageDescription(string description)] Interface, class Human-readable description, used in the generated .packageschema.md.
[PackageProviderOwner(string name)] Class Team or vendor responsible for a provider, used in the generated .packageschema.md.
[ProviderAggregator(Type contract, string? name = null)] Class Makes a partial class fan out each method of the contract port to every provider listed with [PackageProvider<T>].

PackageLifetime (namespace Kanject.Core.Packages.Annotations.Attributes.Enums) has Scoped (default), Singleton, and Transient. It mirrors ServiceLifetime so this package stays dependency-free.

Example

using Kanject.Core.Packages.Annotations.Attributes;
using Kanject.Core.Packages.Annotations.Attributes.Enums;

[Package(id: "payment.gateway")]
[PackageDescription("Process order payments through third-party gateways")]
public interface IPaymentGateway
{
    Task<ChargeResult> ChargeAsync(ChargeRequest request, CancellationToken cancellationToken);
}

[Package<IPaymentGateway>]
[PackageProvider(id: "stripe.payment.gateway", version: 2, Lifetime = PackageLifetime.Singleton)]
[PackageProviderOwner("Payments team")]
[PackageResolverKey("stripe")]
[DefaultPackageProvider]
public sealed partial class StripePaymentGatewayV2 : IPaymentGateway
{
    public Task<ChargeResult> ChargeAsync(ChargeRequest request, CancellationToken cancellationToken)
        => throw new NotImplementedException();
}

The attributes do nothing on their own. The generator in Kanject.Core.Packages.Annotations turns them into code, and its analyzers check that they are used consistently. Declare [Package] interfaces in a project that runs the generator, because that project is where the manager and resolver are generated.

Package Role Availability
Kanject.Core.Packages.Annotations Source generator + analyzers that read these attributes nuget.org
Kanject.Core.Packages Runtime: IPackageScope, PackageScopeBuilder, provider catalog, graph validator 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.Packages.Annotations.Attributes:

Package Downloads
Kanject.Core.Packages.Annotations

Roslyn source generator + analyzers for the Kanject package manager — emits lifetime-aware resolvers, package managers, keyed DI, cross-assembly provider manifests, metadata, scope dispatch and the package-graph contributor for [Package]/[PackageProvider]-annotated types.

Kanject.Core.Packages

Kanject Core Packages — the runtime for the Kanject package manager: cross-assembly provider manifests/catalog, IPackageScope, PackageScopeBuilder/PackageScopeSelection, keyed-DI dispatch, and the AOT-clean package-graph validator (ValidatePackageGraph). Attribute-driven provider dispatch generated by Kanject.Core.Packages.Annotations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.13.1 161 9/27/2026
3.13.0 126 9/27/2026
3.12.7 139 9/26/2026
3.12.6 179 9/7/2026
3.12.5 131 8/27/2026
3.12.4 137 8/22/2026
3.12.3 151 8/10/2026
3.12.2 145 8/9/2026
3.12.1 153 8/5/2026
3.12.0 167 8/5/2026
3.11.0 159 8/3/2026
3.10.5 163 7/30/2026
3.10.4 178 7/18/2026
3.10.3 167 7/13/2026
3.10.2 162 7/11/2026
3.10.1 168 7/11/2026
3.10.0 185 7/9/2026
3.9.1 156 7/9/2026