abpframework/abp · error · Exception
There are more than 1 config (abp-build-config.json) file in
Error message
There are more than 1 config (abp-build-config.json) file in the directory!
What it means
Thrown by FileSystemDotNetProjectBuildConfigReader.Read when Directory.GetFiles finds more than one 'abp-build-config.json' in the working directory (TopDirectoryOnly). The reader can only consume a single build-config file per directory; ambiguity is treated as an error rather than guessing.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs:59
return buildConfig;
}
var configFiles = Directory.GetFiles(directoryPath, _buildConfigName, SearchOption.TopDirectoryOnly);
if (configFiles.Length == 1)
{
var configFile = configFiles.First();
var configFileContent = File.ReadAllText(configFile);
buildConfig.GitRepository = _jsonSerializer.Deserialize<GitRepository>(configFileContent);
SetBranchNames(buildConfig.GitRepository);
return buildConfig;
}
if (configFiles.Length > 1)
{
throw new Exception(
"There are more than 1 config (abp-build-config.json) file in the directory!"
);
}
return new DotNetProjectBuildConfig
{
GitRepository = GetGitRepositoryUsingDirectory(directoryPath)
};
}
private GitRepository GetGitRepositoryUsingDirectory(string directoryPath)
{
var directoryInfo = new DirectoryInfo(directoryPath);
do
{
var gitFolderPath = string.Concat(directoryInfo.FullName, @"\.git");
if (Directory.Exists(gitFolderPath))View on GitHub (pinned to 7ed43b1931)
Solutions
- List abp-build-config.json files in the directory and keep exactly one (delete or relocate the duplicate).
- If the configs differ intentionally, merge them into a single abp-build-config.json with the correct GitRepository definition.
- Point the ABP build command at a directory that contains exactly one config file.
- Add the stray config to source-control ignore if it is a generated artifact.
Example fix
# before: two config files present find . -maxdepth 1 -name 'abp-build-config.json' # ./abp-build-config.json # ./abp-build-config.json.bak (or a second copy) # after: remove the duplicate rm ./abp-build-config.json.bak abp build
Defensive patterns
Strategy: validation
Validate before calling
// Ensure exactly one abp-build-config.json in the directory.
var configs = Directory.GetFiles(directoryPath, "abp-build-config.json", SearchOption.TopDirectoryOnly);
if (configs.Length > 1)
{
throw new InvalidOperationException($"Found {configs.Length} abp-build-config.json files; keep exactly one. Files: {string.Join(", ", configs)}");
} Type guard
public static bool HasSingleBuildConfig(string directoryPath) =>
Directory.GetFiles(directoryPath, "abp-build-config.json", SearchOption.TopDirectoryOnly).Length == 1; Try / catch
try
{
var cfg = reader.Read(directoryPath);
}
catch (Exception ex) when (ex.Message.Contains("more than 1 config", StringComparison.Ordinal))
{
logger.LogError(ex, "Multiple abp-build-config.json files; remove the duplicate.");
throw;
} Prevention
- Keep a single abp-build-config.json per build directory.
- Add generated/backup configs to .gitignore to prevent accidental duplicates.
- Review directory contents before running 'abp build' after a branch merge.
- Merge differing configs instead of leaving side-by-side copies.
When it happens
Trigger: Read(directoryPath) runs, the .sln/.slnx count is not exactly one, and configFiles (abp-build-config.json) length is > 1. Common when config files were duplicated by a copy, merge, or template operation.
Common situations: A previous build artifact copied the config into a subfolder that is now the working directory; a solution-to-folder restructure left two configs; merging branches duplicated the file; a sample/template generated an extra config alongside an existing one.
Related errors
- There is no solution file (*.sln or *.slnx) and {_buildConfi
- Remote origin is null for given repository !
- Couldn't find repository name using remote origin url !
- Cyclic dependency found! Item: {item}
- Build failed!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/6eaaeb236622844b.
Report an issue: GitHub.