{"record":{"id":"2975846b60b65857","repo":"abpframework/abp","slug":"option-folder-should-be-a-directory","errorCode":null,"errorMessage":"Option folder should be a directory.","messagePattern":"Option folder should be a directory\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs","lineNumber":666,"sourceCode":"    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":648,"sourceCodeEnd":670,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/CSharp/CSharpServiceProxyGenerator.cs#L648-L670","documentation":"CheckFolder throws a CliUsageException when --folder is non-empty and Path.HasExtension(folder) returns true, i.e. the value looks like a file (has an extension) rather than a directory. The folder option must be a directory path used as the proxy output location.","triggerScenarios":"Passing --folder with a value like 'Proxies.cs' or 'src/Services/File.cs' that contains a dot-separated extension. Path.HasExtension treats anything after the last dot as an extension.","commonSituations":"Confusing --folder (output directory) with a file path; copy-pasting a file path from a tutorial; trailing '.ts' or '.cs' mistakenly appended.","solutions":["Pass a directory path without a file extension: --folder src/app/proxies rather than --folder src/app/proxies.ts.","If you intended to specify an output file, omit --folder and use the generator's default output convention.","Re-run after correcting the value."],"exampleFix":"// before\nabp generate-proxy -t csharp --folder Proxies/Service.cs\n// after\nabp generate-proxy -t csharp --folder Proxies/Service","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrWhiteSpace(folder) && Path.HasExtension(folder))\n{ Console.Error.WriteLine($\"--folder '{folder}' looks like a file; pass a directory.\"); return; }","typeGuard":"static bool IsValidFolderOption(string folder) =>\n    string.IsNullOrWhiteSpace(folder) || !Path.HasExtension(folder);","tryCatchPattern":null,"preventionTips":["Document that --folder expects a directory, not a file.","Validate user-supplied options in your wrapper script."],"tags":["cli","service-proxy","argument-validation","path-resolution"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}