.NET SDK
Use this page to integrate LicenseKit from .NET with the first-party LicenseKit package.
Who This Is For
- C# and .NET developers integrating licensing into services or desktop-adjacent apps
- teams that want generated management/runtime/system clients
- AI agents generating .NET integration code
When To Use This
Use this page when your integration language is .NET and you want the first-party package instead of hand-rolled HTTP clients.
How It Works
Install
bash
dotnet add package LicenseKit --prereleaseClient split
The package exposes:
ManagementClientRuntimeClientSystemClient- verification helpers
- operation id and scope metadata constants
Auth split
ManagementClientuses bearer authRuntimeClientuses license authSystemClientuses no auth
Reporting support
The management client includes reporting operations and export flows.
Expected generated method names follow the established Async pattern:
ListActivitiesAsyncGetUsageSummaryAsyncListUsageLedgerAsyncGetLicenseAuditReportAsyncGetCustomerSummaryAsyncGetSubscriptionSettlementAsyncCreateReportExportAsyncGetReportExportAsyncDownloadReportExportAsync
Scope metadata
csharp
var scopes = Scopes.GetRequiredScopes(OperationIds.CreateReportExport);
var allowed = Scopes.HasRequiredScopes(
OperationIds.GetUsageSummary,
new[] { ManagementScopeNames.ReportRead }
);Example
Runtime validation and verification:
csharp
using LicenseKit;
var baseUrl = "https://api.licensekit.dev";
var runtime = new RuntimeClient(new RuntimeClientOptions
{
BaseUrl = baseUrl,
LicenseKey = Environment.GetEnvironmentVariable("LICENSEKIT_LICENSE_KEY")!
});
var system = new SystemClient(new SystemClientOptions
{
BaseUrl = baseUrl
});
var result = await runtime.ValidateLicenseAsync(new OperationRequest
{
Body = new
{
fingerprint = "host-123"
}
});
var publicKeys = await system.ListPublicKeysAsync();
var verified = Verification.VerifyRuntimeResult(
result,
PublicKeyStore.FromManagementResult(publicKeys)
);Reporting read example:
csharp
using System.Collections.Generic;
var management = new ManagementClient(new ManagementClientOptions
{
BaseUrl = baseUrl,
Token = Environment.GetEnvironmentVariable("LICENSEKIT_MANAGEMENT_TOKEN")!
});
var summary = await management.GetUsageSummaryAsync(new OperationRequest
{
Query = new Dictionary<string, object?>
{
["product_id"] = "prod_123",
["group_by"] = "customer_id"
}
});Common Mistakes
- assuming reporting routes require a separate client instead of the management client
- using
report:readfor export creation or download - trusting runtime data without verification
- confusing operation id constants with scope name constants