Bitwarden.Server.Sdk.Environment 0.1.0

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

Bitwarden.Server.Sdk.Environment

Provides runtime environment information for Bitwarden server services, including version, Git hash, and self-host details.

Getting Started

Register the environment services in your DI container:

services.AddBitwardenEnvironment();

If your service can run in a self-hosted configuration, configure SelfHostDetails accordingly:

using Bitwarden.Server.Sdk.Environment.Setup;

// For a self-hosted instance:
services.Configure<SelfHostDetails>(details => details.MakeSelfHost("lite"));

// For a cloud instance (this is the default):
services.Configure<SelfHostDetails>(details => details.MakeCloud());

Usage

Inject IBitwardenEnvironment wherever you need environment information:

public class MyService(IBitwardenEnvironment environment)
{
    public void LogInfo()
    {
        Console.WriteLine($"Version:     {environment.Version}");
        Console.WriteLine($"Git hash:    {environment.GitHash}");
        Console.WriteLine($"Self-hosted: {environment.SelfHosted}");
        Console.WriteLine($"Flavor:      {environment.SelfHostFlavor}");
    }
}

Version Resolution

The version and Git hash are read from the AssemblyInformationalVersionAttribute of the application's entry assembly. The attribute value is expected to follow the format {version}+{gitHash} (e.g., 1.2.3+af18b2952b), which is produced automatically by the .NET SDK when source control metadata is embedded in the build.

If the attribute is missing or cannot be parsed, Version returns an empty string and GitHash returns null, and a warning is logged.

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 (2)

Showing the top 2 NuGet packages that depend on Bitwarden.Server.Sdk.Environment:

Package Downloads
Bitwarden.Server.Sdk.Features

Feature flag support for Bitwarden server services, backed by LaunchDarkly. Includes middleware, endpoint conventions, and controller attributes for remotely toggling features.

Bitwarden.Server.Sdk.WebEssentials

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 95 7/28/2026