Adliance.AspNetCore.Buddy.GuiKit.Infrastructure 10.2.0.14

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

Adliance.AspNetCore.Buddy.GuiKit.Infrastructure

Hosting infrastructure for Adliance ASP.NET Core applications: Application Insights and Azure Key Vault, each set up with one call and only enabled when it is configured. Apps therefore run unchanged locally, where neither is needed, and in Azure, where both are configured.

The package is a dependency of Adliance.AspNetCore.Buddy.GuiKit, so apps using GuiKit already have it.

Setup

using Adliance.AspNetCore.Buddy.GuiKit.Infrastructure.Extensions;

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddKeyVaultIfConfigured(builder.Environment);
builder.Services.AddApplicationInsightsIfConfigured();

Application Insights

AddApplicationInsightsIfConfigured enables Application Insights telemetry if the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable is set (as Azure App Service does when Application Insights is enabled), and writes to the console whether it did. The app's InformationalVersion is reported as the application version, so telemetry can be told apart by release.

It also registers AppInsightsJavaScript, which renders the Application Insights JavaScript snippet for browser telemetry. GuiKit's _AgkLayout already renders it; in other layouts, inject it:

@inject Adliance.AspNetCore.Buddy.GuiKit.Infrastructure.AppInsightsJavaScript AppInsights

@AppInsights.GetString(nonce)

GetString renders the <script> tag (with the nonce for a Content Security Policy, if given), ScriptBody only its content. Both are empty when Application Insights is not configured.

App version

AppVersion.Current is the app's version: the InformationalVersion of its entry assembly (eg. set by the build pipeline), or an empty string without one. It's the application version reported to Application Insights, and the cache buster of GuiKit's layouts - use it for the app's own static files as well, so browsers load them again after an update (see UseGuiKitStaticFiles in the GuiKit README):

@using Adliance.AspNetCore.Buddy.GuiKit.Infrastructure

<link rel="stylesheet" href="~/styles.css?v=@AppVersion.Current"/>

Azure Key Vault

AddKeyVaultIfConfigured adds an Azure Key Vault as a configuration source if the KeyVault connection string is configured, eg. as the KeyVault environment variable or in appsettings.json. Secret names use -- where the configuration key uses :, eg. the secret Claude--ApiKey is the configuration value Claude:ApiKey.

The configuration sources are ordered (lowest to highest precedence) as:

  1. appsettings.json
  2. Key Vault
  3. environment variables
  4. appsettings.{Environment}.json

so Key Vault overrides the shared defaults, while environment variables and environment-specific appsettings can still override Key Vault. Sources added after these (eg. user secrets, command line arguments) keep their position.

Connection string

The connection string is the vault URI, optionally followed by credentials:

VaultUri=https://my-vault.vault.azure.net/;TenantId=...;ClientId=...;ClientSecret=...

The URI alone (https://my-vault.vault.azure.net/) is a valid connection string, too. Keys are case-insensitive; VaultUrl, Uri and Url are accepted for VaultUri.

How the app authenticates against the vault depends on what the connection string contains:

Connection string Credential
TenantId, ClientId and ClientSecret the app registration with this client secret, anywhere
no client secret, in Development the developer logged in with the Azure CLI (az login)
no client secret, otherwise the app's managed identity: the user-assigned one with ClientId, else the system-assigned one

Unlike DefaultAzureCredential, which tries every credential source in turn (and spends ~25 seconds probing for a managed identity on a development machine), this picks the one credential that can work, so startup is not delayed.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Adliance.AspNetCore.Buddy.GuiKit.Infrastructure:

Package Downloads
Adliance.AspNetCore.Buddy.GuiKit

Library of CSS, JavaScript, TagHelpers and layouts for a commonly shared Adliance UI.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.2.0.14 41 10/1/2026
10.2.0.13 43 10/1/2026
10.2.0.12 111 10/1/2026