abpframework/abp · error · CliUsageException

Specified directory does not exist.

Error message

Specified directory does not exist.

What it means

CSharpServiceProxyGenerator.CheckWorkDirectory throws a CliUsageException when Directory.Exists(directory) is false. The C# proxy generator needs a valid work directory containing the target Web/HTTP project to discover application services and emit generated files.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs:652

            "System.Double" => "double",
            "Double" => "double",
            "System.Object" => "object",
            "Object" => "object",
            "System.Byte" => "byte",
            "Byte" => "byte",
            "System.Char" => "char",
            "Char" => "char",
            _ => typeName
        };

        return $"{typeName}{nullable}";
    }

    private static void CheckWorkDirectory(string directory)
    {
        if (!Directory.Exists(directory))
        {
            throw new CliUsageException("Specified directory does not exist.");
        }

        var projectFiles = Directory.GetFiles(directory, "*.csproj");
        if (!projectFiles.Any())
        {
            throw new CliUsageException("No project file(csproj) found in the directory.");
        }
    }

    private static void CheckFolder(string folder)
    {
        if (!folder.IsNullOrWhiteSpace() && Path.HasExtension(folder))
        {
            throw new CliUsageException("Option folder should be a directory.");
        }
    }
}

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Verify the path exists: 'ls <work-directory>'.
  2. Use an absolute path for --work-directory to avoid cwd-relative resolution issues.
  3. cd into the project folder and re-run without --work-directory so the current directory is used.

Example fix

// before
abp generate-proxy -t csharp -wd ./Acme.App.HttpApi.Client
// after
abp generate-proxy -t csharp -wd /repo/src/Acme.App.HttpApi.Client
Defensive patterns

Strategy: validation

Validate before calling

if (!Directory.Exists(workDirectory))
{ Console.Error.WriteLine($"Work directory '{workDirectory}' does not exist."); return; }

Prevention

When it happens

Trigger: Running 'abp generate-proxy -t csharp' with a --work-directory / -wd argument pointing to a path that does not exist on disk, or running from a directory that has been deleted or mis-typed.

Common situations: Typo in the work-directory path; relative path resolved against the wrong current directory; directory deleted in a clean/Rebuild; CI runner using a checkout path that does not exist.

Related errors


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