{"record":{"id":"e8e6b30109ca1f99","repo":"abpframework/abp","slug":"couldn-t-find-any-project-solution","errorCode":null,"errorMessage":"Couldn't find any project/solution.","messagePattern":"Couldn't find any project/solution\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs","lineNumber":96,"sourceCode":"            withSourceCode,\n            addSourceCodeToSolutionFile\n        );\n    }\n\n    public async Task AddAsync(\n        string solutionFile,\n        string projectFile,\n        NugetPackageInfo package,\n        string version = null,\n        bool useDotnetCliToInstall = true,\n        bool withSourceCode = false,\n        bool addSourceCodeToSolutionFile = false)\n    {\n        if (projectFile == null)\n        {\n            if (solutionFile == null)\n            {\n                throw new CliUsageException(\"Couldn't find any project/solution.\");\n            }\n\n            projectFile = GetProjectFile(solutionFile, package);\n\n            if (projectFile == null)\n            {\n                throw new CliUsageException(\"Couldn't find any project/solution.\");\n            }\n        }\n\n        solutionFile ??= FindSolutionFile(projectFile);\n\n        if (version == null)\n        {\n            version = GetAbpVersionOrNull(projectFile);\n        }\n\n        await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall);","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs#L78-L114","documentation":"First of two sibling checks in AddAsync to ProjectNugetPackageAdder: when neither a projectFile nor a solutionFile can be determined (both null), the CLI cannot locate any target to install the NuGet package into, so it throws a CliUsageException. This branch fires before attempting to derive a project from the solution.","triggerScenarios":"Running 'abp add-package <pkg>' in a directory that contains neither a .sln nor a .csproj, or calling AddAsync without passing solutionFile/projectFile when the current working directory has no recognizable solution/project.","commonSituations":"Wrong working directory (running from repo root, docs folder, or src subfolder with no .sln); deleted .sln; running the command inside a folder unrelated to the ABP solution.","solutions":["cd into the folder containing your .sln (or pass --solution / --project explicitly) and re-run.","Verify the .sln / .csproj exists with 'ls *.sln *.csproj'.","Pass the path explicitly: 'abp add-package <pkg> --project ./src/Acme.MyProject/Acme.MyProject.csproj'."],"exampleFix":"// before (run from /docs)\nabp add-package Volo.Abp.AspNetCore.Mvc\n// after\ncd /repo/Acme.App\nabp add-package Volo.Abp.AspNetCore.Mvc","handlingStrategy":"validation","validationCode":"string sln = Directory.GetFiles(Environment.CurrentDirectory, \"*.sln\").FirstOrDefault();\nstring proj = Directory.GetFiles(Environment.CurrentDirectory, \"*.csproj\").FirstOrDefault();\nif (sln == null && proj == null)\n{ Console.Error.WriteLine(\"No .sln or .csproj in current directory.\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run 'abp add-package' from the solution root.","In automation, assert the working directory contains a solution file before invoking."],"tags":["cli","package-management","nuget","path-resolution","argument-validation"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}