{"record":{"id":"3484f5e6c1997ca9","repo":"abpframework/abp","slug":"no-project-file-csproj-found-in-the-directory","errorCode":null,"errorMessage":"No project file(csproj) found in the directory.","messagePattern":"No project file\\(csproj\\) found in the directory\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs","lineNumber":658,"sourceCode":"            \"System.Char\" => \"char\",\n            \"Char\" => \"char\",\n            _ => typeName\n        };\n\n        return $\"{typeName}{nullable}\";\n    }\n\n    private static void CheckWorkDirectory(string directory)\n    {\n        if (!Directory.Exists(directory))\n        {\n            throw new CliUsageException(\"Specified directory does not exist.\");\n        }\n\n        var projectFiles = Directory.GetFiles(directory, \"*.csproj\");\n        if (!projectFiles.Any())\n        {\n            throw new CliUsageException(\"No project file(csproj) found in the directory.\");\n        }\n    }\n\n    private static void CheckFolder(string folder)\n    {\n        if (!folder.IsNullOrWhiteSpace() && Path.HasExtension(folder))\n        {\n            throw new CliUsageException(\"Option folder should be a directory.\");\n        }\n    }\n}\n","sourceCodeStart":640,"sourceCodeEnd":670,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs#L640-L670","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Point --work-directory at the folder that directly contains the .csproj (typically *.HttpApi.Client).","Verify with 'ls <dir>/*.csproj'.","If the project does not exist yet, create it (e.g. add an HttpApi.Client project) before generating proxies."],"exampleFix":"// before\nabp generate-proxy -t csharp -wd ./src   // no csproj directly\n// after\nabp generate-proxy -t csharp -wd ./src/Acme.App.HttpApi.Client","handlingStrategy":"validation","validationCode":"if (!Directory.GetFiles(workDirectory, \"*.csproj\").Any())\n{ Console.Error.WriteLine($\"No .csproj in '{workDirectory}'.\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point --work-directory at the folder that directly contains the .csproj.","Validate csproj presence before generating proxies."],"tags":["cli","service-proxy","csharp","project-resolution","argument-validation"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}