chocolatey/choco · error · ApplicationException
Unable to load licensed assembly.
Error message
Unable to load licensed assembly.
What it means
Thrown by License loading when AssemblyResolution.LoadExtension returns null for the licensed Chocolatey assembly (chocolatey.licensed). The licensed extension assembly could not be located or loaded by the extension loader, so license construction aborts before any version-compatibility checks run.
Source
Thrown at src/chocolatey/infrastructure/licensing/License.cs:43
public static class License
{
public static ChocolateyLicense ValidateLicense()
{
var license = LicenseValidation.Validate();
if (license.IsLicensedVersion())
{
try
{
#if FORCE_CHOCOLATEY_OFFICIAL_KEY
var chocolateyPublicKey = ApplicationParameters.OfficialChocolateyPublicKey;
#else
var chocolateyPublicKey = ApplicationParameters.UnofficialChocolateyPublicKey;
#endif
var licensedAssembly = AssemblyResolution.LoadExtension(ApplicationParameters.LicensedChocolateyAssemblySimpleName);
if (licensedAssembly == null)
{
throw new ApplicationException("Unable to load licensed assembly.");
}
license.AssemblyLoaded = true;
license.Assembly = licensedAssembly;
license.Version = VersionInformation.GetCurrentInformationalVersion(licensedAssembly);
// The licensed assembly is installed, check its supported Chocolatey versions and/or the assembly
// version so we can attempt to determine whether it's compatible with this version of Chocolatey.
var minimumChocolateyVersionString = VersionInformation.GetMinimumChocolateyVersion(licensedAssembly);
"chocolatey".Log().Debug("Minimum Chocolatey Version: '{0}'".FormatWith(minimumChocolateyVersionString));
var currentChocolateyVersionString = VersionInformation.GetCurrentAssemblyVersion();
"chocolatey".Log().Debug("Current Chocolatey Version: '{0}'".FormatWith(currentChocolateyVersionString));
var currentChocolateyLicensedVersionString = VersionInformation.GetCurrentAssemblyVersion(licensedAssembly);
"chocolatey".Log().Debug("Current Chocolatey Licensed Version: '{0}'".FormatWith(currentChocolateyLicensedVersionString));
var minimumChocolateyVersion = new Version(minimumChocolateyVersionString);
var currentChocolateyVersion = new Version(currentChocolateyVersionString);
var currentChocolateyLicensedVersion = new Version(currentChocolateyLicensedVersionString);
View on GitHub (pinned to 0d5abdd10c)
Solutions
- Install or reinstall the licensed package: choco install chocolatey.extension (or the appropriate licensed extension package).
- Verify the build matches the key flavor - unofficial builds cannot load officially-signed licensed assemblies and vice versa; rebuild/reinstall the matching flavor.
- Check the Chocolatey log for the inner load failure (dependency not found, BadImageFormatException) and resolve that dependency.
- Confirm the extensions directory contains the expected chocolatey.licensed.dll and is not corrupted.
Example fix
// before: missing/old extension choco upgrade chocolatey -y // licensed.dll never installed // after choco upgrade chocolatey.extension -y choco upgrade chocolatey -y
Defensive patterns
Strategy: try-catch
Validate before calling
var extDir = Environment.GetEnvironmentVariable("ChocolateyInstall") is string ci
? System.IO.Path.Combine(ci, "extensions")
: System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "extensions");
if (!System.IO.Directory.EnumerateFiles(extDir, "chocolatey.licensed.dll", SearchOption.AllDirectories).Any())
throw new InvalidOperationException("chocolatey.licensed assembly not found. Install/upgrade the licensed extension package."); Try / catch
try
{
license = License.LoadLicense();
}
catch (ApplicationException ex) when (ex.Message.Contains("Unable to load licensed assembly"))
{
logger.Warn(ex.Message + " Licensed features disabled. Install chocolatey.extension or check build key flavor.");
} Prevention
- Keep the licensed extension package installed and version-aligned with the Chocolatey build.
- Match the build's public-key flavor (official vs unofficial) so the licensed assembly is accepted.
- Make the licensed-extension load failure non-fatal in calling code so FOSS features keep working.
When it happens
Trigger: Chocolatey attempts to load its commercial/licensed extension (typically chocolatey.licensed.dll) and the resolution returns null - the assembly is absent from the extensions directory, has the wrong strong-name/public key, or failed to load due to a dependency mismatch.
Common situations: A licensed Chocolatey install where the licensed package was not installed/upgraded, a public-key mismatch between official and unofficial builds (controlled by FORCE_CHOCOLATEY_OFFICIAL_KEY), a .NET runtime/dependency incompatibility breaking assembly load, or a corrupted extensions folder.
Related errors
- Automatic package creation from installer files only availab
- It appears you are attempting to use options that may be onl
- License is missing or invalid.
- Unable to find suitable location for PowerShell. Searched th
AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13).
Data as JSON: /api/errors/539d0322dfbe6f93.
Report an issue: GitHub.