abpframework/abp · error · CliUsageException

No project file(csproj) found in the directory.

Error message

No project file(csproj) found in the directory.

What it means

The second branch of CheckWorkDirectory: the directory exists but Directory.GetFiles(directory, "*.csproj") returns no entries. The C# proxy generator needs a .csproj inside the work directory to attach the generated proxy files; absence means the work directory is not a project root.

Source

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

            "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. Point --work-directory at the folder that directly contains the .csproj (typically *.HttpApi.Client).
  2. Verify with 'ls <dir>/*.csproj'.
  3. If the project does not exist yet, create it (e.g. add an HttpApi.Client project) before generating proxies.

Example fix

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

Strategy: validation

Validate before calling

if (!Directory.GetFiles(workDirectory, "*.csproj").Any())
{ Console.Error.WriteLine($"No .csproj in '{workDirectory}'."); return; }

Prevention

When it happens

Trigger: Pointing --work-directory at a folder that contains source files but no project file (a src/ container, a solution root with only .sln, or a folder of shared code).

Common situations: Passing the solution folder instead of the specific .HttpApi.Client project folder; multi-project folder where the .csproj is one level deeper; project recently deleted/not yet created.

Related errors


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