abpframework/abp · error · CliUsageException
Specified directory does not exist.
Error message
Specified directory does not exist.
What it means
Thrown by SwitchToLocal.ExecuteAsync when the resolved working directory doesn't exist on the filesystem. The working directory comes from the -s/--solution option (or current directory if not specified). If the option value ends in .sln/.slnx/.csproj, GetWorkingDirectory extracts the parent directory via Path.GetDirectoryName. Directory.Exists then returns false for this path.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToLocalCommand.cs:32
public class SwitchToLocal : IConsoleCommand, ITransientDependency
{
private readonly LocalReferenceConverter _localReferenceConverter;
public const string Name = "switch-to-local";
public ILogger<SwitchToLocal> Logger { get; set; }
public SwitchToLocal(LocalReferenceConverter localReferenceConverter)
{
_localReferenceConverter = localReferenceConverter;
}
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
var workingDirectory = GetWorkingDirectory(commandLineArgs) ?? Directory.GetCurrentDirectory();
if (!Directory.Exists(workingDirectory))
{
throw new CliUsageException(
"Specified directory does not exist." +
Environment.NewLine + Environment.NewLine +
GetUsageInfo()
);
}
await _localReferenceConverter.ConvertAsync(workingDirectory, GetPaths(commandLineArgs));
}
private List<string> GetPaths(CommandLineArgs commandLineArgs)
{
var paths = commandLineArgs.Options.GetOrNull(
Options.LocalPaths.Short,
Options.LocalPaths.Long
);
if (paths == null)
{View on GitHub (pinned to 7ed43b1931)
Solutions
- Verify the directory exists: 'ls <path>' on Linux/Mac or 'dir <path>' on Windows
- Use an absolute path starting from the filesystem root
- If pointing to a .sln file, ensure the file exists and the parent directory is valid
- Check for case-sensitivity issues on Linux/macOS
Example fix
// before abp switch-to-local -s /wrond/path --paths /abp // after abp switch-to-local -s /correct/path --paths /abp
Defensive patterns
Strategy: validation
Validate before calling
// Validate directory exists before running switch-to-local
var workingDir = GetWorkingDirectory(commandLineArgs) ?? Directory.GetCurrentDirectory();
if (!Directory.Exists(workingDir))
{
Console.Error.WriteLine($"Error: Directory does not exist: {workingDir}");
return;
} Try / catch
try
{
await switchToLocal.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Specified directory does not exist"))
{
Console.Error.WriteLine($"Directory not found. Verify the path with 'ls' and use absolute paths.");
} Prevention
- Always use absolute paths for the --solution option
- Verify directory existence before running the command
- Watch for case-sensitivity on Linux/macOS
- Ensure network drives are mounted before referencing them
When it happens
Trigger: Running 'abp switch-to-local -s <nonexistent-path>' or running from a deleted/unmounted directory. Also triggered when --solution points to a .sln file whose parent directory doesn't exist.
Common situations: Typo in the path, pointing to a network share that's disconnected, path copied from a different machine, case-sensitivity mismatch on Linux/macOS, relative path resolving from the wrong cwd.
Related errors
- Local paths are not specified!
- Should specify an option name after '--' prefix!
- Should specify an option name after '-' prefix!
- Option names should start with '-' or '--'.
- ERROR: Remote server returns '{response.StatusCode}'
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/9a80620cf8e95d8b.
Report an issue: GitHub.