abpframework/abp · error · CliUsageException

Project name is missing!

Error message

Project name is missing!

What it means

Thrown by NewCommand.ExecuteAsync when the project name (commandLineArgs.Target after namespace normalization) is null or whitespace. The `abp new` command requires a project name as its positional argument. The error includes usage info appended via GetUsageInfo(). After validation, it also runs ProjectNameValidator.Validate() for format compliance.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs:74

            angularPwaSupportAdder,
            initialMigrationCreator,
            themePackageAdder,
            eventBus,
            bundlingService,
            angularThemeConfigurer,
            cliVersionService)
    {
        TemplateInfoProvider = templateInfoProvider;
        TemplateProjectBuilder = templateProjectBuilder;
        _telemetryService = telemetryService;
    }

    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
    {
        var projectName = NamespaceHelper.NormalizeNamespace(commandLineArgs.Target);
        if (string.IsNullOrWhiteSpace(projectName))
        {
            throw new CliUsageException("Project name is missing!" + Environment.NewLine + Environment.NewLine + GetUsageInfo());
        }

        ProjectNameValidator.Validate(projectName);

        Logger.LogInformation("Creating your project...");
        Logger.LogInformation("Project name: " + projectName);

        var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long);
        if (template != null)
        {
            Logger.LogInformation("Template: " + template);
        }
        else
        {
            template = (await TemplateInfoProvider.GetDefaultAsync()).Name;
        }

        var isTiered = commandLineArgs.Options.ContainsKey(Options.Tiered.Long);

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Provide a project name as the first positional argument: `abp new MyCompany.MyProject`
  2. Ensure the name follows .NET namespace conventions (PascalCase, alphanumeric, dots for separation)
  3. Use `abp new --help` to see the full usage including template and other options

Example fix

// before
abp new --template app

// after
abp new MyCompany.MyProject --template app
Defensive patterns

Strategy: validation

Validate before calling

// Validate project name before calling NewCommand
var projectName = NamespaceHelper.NormalizeNamespace(rawProjectName);
if (string.IsNullOrWhiteSpace(projectName))
{
    Console.Error.WriteLine("Error: Project name is required. Example: abp new MyCompany.MyProject");
    return;
}

Try / catch

try
{
    await newCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Project name is missing"))
{
    logger.LogError("Usage: abp new <ProjectName> [--template <template>]");
}

Prevention

When it happens

Trigger: Running `abp new` without a project name, or passing only whitespace. NamespaceHelper.NormalizeNamespace() returns an empty/null string and IsNullOrWhiteSpace() catches it.

Common situations: Developer runs `abp new --template app` forgetting the project name, or passes the name as a named option instead of positional. Also from scripts that construct the command dynamically with a missing variable.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/78520c1699864cab. Report an issue: GitHub.