abpframework/abp · error · CliUsageException
The option you provided for UI Framework is invalid!
Error message
The option you provided for UI Framework is invalid!
What it means
Thrown by ProjectCreationCommandBase.GetUiFramework when the UI framework option value does not match any case: mvc, angular, blazor, blazor-server, blazor-webapp, or (for AppPro template only) maui-blazor. The default case throws CliUsageException. The maui-blazor option is gated to the AppPro template specifically.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs:684
{
case null:
return UiFramework.NotSpecified;
case "none":
return UiFramework.None;
case "mvc":
return UiFramework.Mvc;
case "angular":
return UiFramework.Angular;
case "blazor":
return UiFramework.Blazor;
case "blazor-server":
return UiFramework.BlazorServer;
case "blazor-webapp":
return UiFramework.BlazorWebApp;
case "maui-blazor" when template == AppProTemplate.TemplateName:
return UiFramework.MauiBlazor;
default:
throw new CliUsageException(ExceptionMessageHelper.GetInvalidOptionExceptionMessage("UI Framework"));
}
}
protected virtual Theme? GetThemeByTemplateOrNull(CommandLineArgs commandLineArgs, string template = "app")
{
var theme = commandLineArgs.Options.GetOrNull(Options.Theme.Long)?.ToLowerInvariant();
return template switch
{
AppTemplate.TemplateName or AppNoLayersTemplate.TemplateName => GetAppTheme(),
AppProTemplate.TemplateName or AppNoLayersProTemplate.TemplateName or MicroserviceProTemplate.TemplateName => GetAppProTheme(),
_ => null
};
Theme GetAppTheme()
{
return theme switch
{View on GitHub (pinned to 7ed43b1931)
Solutions
- Use one of the supported UI frameworks: mvc, angular, blazor, blazor-server, blazor-webapp
- For maui-blazor, use the AppPro template: `abp new MyProject -t app-pro -u maui-blazor`
- Check spelling — values are lowercase and must match exactly (e.g., 'blazor-server' not 'blazorserver')
Example fix
// before abp new MyProject -u react // after abp new MyProject -u angular
Defensive patterns
Strategy: validation
Validate before calling
// Validate UI framework option
var validUi = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{ "mvc", "angular", "blazor", "blazor-server", "blazor-webapp", "maui-blazor" };
if (optionValue == "maui-blazor" && template != AppProTemplate.TemplateName)
{
Console.Error.WriteLine("Error: maui-blazor requires the app-pro template.");
return;
}
if (!validUi.Contains(optionValue ?? ""))
{
Console.Error.WriteLine("Error: UI Framework must be mvc, angular, blazor, blazor-server, or blazor-webapp.");
return;
} Type guard
// Type guard: UI framework valid for the given template
static bool IsValidUiFramework(string? value, string template) => value?.ToLowerInvariant() switch
{
"mvc" or "angular" or "blazor" or "blazor-server" or "blazor-webapp" => true,
"maui-blazor" => template == AppProTemplate.TemplateName,
_ => false
}; Try / catch
try
{
await projectCreationCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("UI Framework is invalid"))
{
logger.LogError("Use: mvc, angular, blazor, blazor-server, blazor-webapp (maui-blazor needs app-pro).");
} Prevention
- Use lowercase exact values matching the switch cases
- maui-blazor is gated to the AppPro template only
- Distinguish blazor (WASM) from blazor-server and blazor-webapp
When it happens
Trigger: Passing a -u/--ui value not in the supported set, or passing 'maui-blazor' with a non-Pro template. The switch falls through all cases to default.
Common situations: Developer passes an outdated or misspelled UI framework name, uses 'react' instead of 'angular', or tries 'maui-blazor' on a non-Pro template. Also when the --no-ui flag is not set and the ui option is missing entirely but the method is still called with an invalid default.
Related errors
- The option you provided for Database Provider is invalid!
- The option you provided for Database Management System is in
- The option you provided for Mobile App is invalid!
- Project name is missing!
- You can only create a new preview solution with preview CLI
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/adbe4b0cb8ff4ec1.
Report an issue: GitHub.