abpframework/abp · error · CliUsageException
Couldn't find any project/solution.
Error message
Couldn't find any project/solution.
What it means
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.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs:96
withSourceCode,
addSourceCodeToSolutionFile
);
}
public async Task AddAsync(
string solutionFile,
string projectFile,
NugetPackageInfo package,
string version = null,
bool useDotnetCliToInstall = true,
bool withSourceCode = false,
bool addSourceCodeToSolutionFile = false)
{
if (projectFile == null)
{
if (solutionFile == null)
{
throw new CliUsageException("Couldn't find any project/solution.");
}
projectFile = GetProjectFile(solutionFile, package);
if (projectFile == null)
{
throw new CliUsageException("Couldn't find any project/solution.");
}
}
solutionFile ??= FindSolutionFile(projectFile);
if (version == null)
{
version = GetAbpVersionOrNull(projectFile);
}
await AddAsPackageReference(projectFile, package, version, useDotnetCliToInstall);View on GitHub (pinned to 7ed43b1931)
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'.
Example fix
// before (run from /docs) abp add-package Volo.Abp.AspNetCore.Mvc // after cd /repo/Acme.App abp add-package Volo.Abp.AspNetCore.Mvc
Defensive patterns
Strategy: validation
Validate before calling
string sln = Directory.GetFiles(Environment.CurrentDirectory, "*.sln").FirstOrDefault();
string proj = Directory.GetFiles(Environment.CurrentDirectory, "*.csproj").FirstOrDefault();
if (sln == null && proj == null)
{ Console.Error.WriteLine("No .sln or .csproj in current directory."); return; } Prevention
- Always run 'abp add-package' from the solution root.
- In automation, assert the working directory contains a solution file before invoking.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not find a class derived from AbpModule in the project
- There are multiple classes derived from AbpModule in the pro
- '{packageName}' nuget package could not be found!
- Option folder should be a directory.
- Package is not found or downloadable!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/e8e6b30109ca1f99.
Report an issue: GitHub.