{"record":{"id":"a102cfc969168aa0","repo":"abpframework/abp","slug":"there-is-no-solution-file-sln-or-slnx-and","errorCode":null,"errorMessage":"There is no solution file (*.sln or *.slnx) and {_buildConfigName} in the working directory and working directory is not a GIT repository !","messagePattern":"There is no solution file \\(\\*\\.sln or \\*\\.slnx\\) and (.+?) in the working directory and working directory is not a GIT repository !","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs","lineNumber":90,"sourceCode":"        var directoryInfo = new DirectoryInfo(directoryPath);\n\n        do\n        {\n            var gitFolderPath = string.Concat(directoryInfo.FullName, @\"\\.git\");\n            if (Directory.Exists(gitFolderPath))\n            {\n                using (var repo = new Repository(string.Concat(directoryInfo.FullName, @\"\\.git\")))\n                {\n                    var repositoryName = GetRepositoryNameFromRepositoryInfo(repo);\n\n                    return new GitRepository(repositoryName, repo.Head.FriendlyName, directoryInfo.FullName);\n                }\n            }\n\n            directoryInfo = directoryInfo.Parent;\n        } while (directoryInfo?.Parent != null);\n\n        throw new Exception(\"There is no solution file (*.sln or *.slnx) and \" + _buildConfigName +\n                            \" in the working directory and working directory is not a GIT repository !\");\n    }\n\n    private string GetRepositoryNameFromRepositoryInfo(Repository repository)\n    {\n        var remote = repository.Network.Remotes.FirstOrDefault(r => r.Name == \"origin\");\n        if (remote == null)\n        {\n            throw new Exception(\"Remote origin is null for given repository !\");\n        }\n\n        var remoteUrl = remote.Url;\n\n        remoteUrl = Regex.Replace(remoteUrl, @\"\\.git$\", \"\");\n\n        remoteUrl = Regex.Replace(remoteUrl, \"^git@\", \"https://\");\n        remoteUrl = Regex.Replace(remoteUrl, \"^https:git@\", \"https://\");\n        remoteUrl = Regex.Replace(remoteUrl, \".com:\", \".com/\");","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Build/FileSystemDotNetProjectBuildConfigReader.cs#L72-L108","documentation":"Thrown by GetGitRepositoryUsingDirectory after walking up the directory tree without finding a .git folder. The reader falls back to inferring the repository from the working directory's git context; if no ancestor is a git repository (and there is no .sln/.slnx or abp-build-config.json), it cannot determine the repo and aborts.","triggerScenarios":"Read was called in a directory with no .sln/.slnx, no abp-build-config.json, and no .git folder in any parent directory up to the filesystem root. The do/while loop in GetGitRepositoryUsingDirectory exhausts all parents and throws.","commonSituations":"Running 'abp build' in a freshly extracted zip that was never git-initialized; running outside any cloned repo; running in a temp/build-output directory detached from the repo; misconfigured CI checkout that did not clone.","solutions":["Run the ABP build command from inside a git working tree (git clone / git init the project first).","Alternatively, place a .sln/.slnx or an abp-build-config.json in the working directory so the reader does not need git inference.","If using a CI runner, ensure the checkout step clones the repository (not a shallow copy without .git) into the working directory.","Verify the working directory path passed to the build command is the repo root or a subdirectory of it."],"exampleFix":"# before: running in a non-git folder\nabp build   # throws: no sln/config/.git\n# after: initialize git, or add a solution/config file\ngit init\nabp build\n# or place a .sln / abp-build-config.json in the directory","handlingStrategy":"validation","validationCode":"// Pre-check: a .git ancestor, or a .sln/.slnx, or a build config must exist.\nbool HasGitAncestor(string path)\n{\n    for (var d = new DirectoryInfo(path); d != null; d = d.Parent)\n        if (Directory.Exists(Path.Combine(d.FullName, \".git\"))) return true;\n    return false;\n}\nvar hasSln = Directory.GetFiles(directoryPath, \"*.sln\").Any() || Directory.GetFiles(directoryPath, \"*.slnx\").Any();\nvar hasCfg = Directory.GetFiles(directoryPath, \"abp-build-config.json\", SearchOption.TopDirectoryOnly).Any();\nif (!hasSln && !hasCfg && !HasGitAncestor(directoryPath))\n{\n    throw new InvalidOperationException(\"No .sln/.slnx, abp-build-config.json, or .git repository found; run inside a git working tree.\");\n}","typeGuard":"public static bool IsInsideGitRepo(string path)\n{\n    for (var d = new DirectoryInfo(path); d != null; d = d.Parent)\n        if (Directory.Exists(Path.Combine(d.FullName, \".git\"))) return true;\n    return false;\n}","tryCatchPattern":"try\n{\n    var cfg = reader.Read(directoryPath);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"no solution file\", StringComparison.Ordinal))\n{\n    logger.LogError(ex, \"Run 'abp build' inside a git working tree or add a solution/build-config file.\");\n    throw;\n}","preventionTips":["Run ABP build commands from within a cloned git repository.","Ensure CI checkouts include the .git folder (avoid shallow/detached copies without it).","Keep a .sln or abp-build-config.json at the repo root.","Document the expected working directory for the build command."],"tags":["cli","build","git","configuration","file-system"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}