{"record":{"id":"65d8b1fc6a16a627","repo":"abpframework/abp","slug":"this-command-should-be-run-inside-a-folder-that-co","errorCode":null,"errorMessage":"This command should be run inside a folder that contains a microservice solution! Or use -{Options.MainSolution.Short} parameter.","messagePattern":"This command should be run inside a folder that contains a microservice solution! Or use -(.+?) parameter\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs","lineNumber":200,"sourceCode":"            {\n                Directory.SetCurrentDirectory(Path.GetDirectoryName(slnPath));\n                outputFolderRoot = Path.GetDirectoryName(slnPath);\n            }\n            else if (!Directory.Exists(slnPath))\n            {\n                slnPath = null;\n            }\n            else\n            {\n                Directory.SetCurrentDirectory(slnPath);\n                outputFolderRoot = slnPath;\n                slnPath = Directory.GetFiles(outputFolderRoot, \"*.sln\")\n                    .Concat(Directory.GetFiles(outputFolderRoot, \"*.slnx\")).FirstOrDefault();\n            }\n\n            if (slnPath == null)\n            {\n                throw new CliUsageException($\"This command should be run inside a folder that contains a microservice solution! Or use -{Options.MainSolution.Short} parameter.\");\n            }\n\n            var microserviceSolutionName = Path.GetFileName(slnPath).RemovePostFix(\".slnx\", \".sln\");\n\n            version ??= SolutionPackageVersionFinder.FindByCsprojVersion(slnPath);\n            solutionName = SolutionName.Parse(microserviceSolutionName, projectName);\n            outputFolder = MicroserviceServiceTemplateBase.CalculateTargetFolder(outputFolderRoot, solutionName.ProjectName);\n            uiFramework = uiFramework == UiFramework.NotSpecified ? FindMicroserviceSolutionUiFramework(outputFolderRoot) : uiFramework;\n        }\n        else\n        {\n            solutionName = SolutionName.Parse(projectName);\n\n            outputFolder = createSolutionFolder ?\n                Path.Combine(outputFolderRoot, SolutionName.Parse(projectName).FullName) :\n                outputFolderRoot;\n        }\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs#L182-L218","documentation":"Thrown by ProjectCreationCommandBase when adding a microservice to a solution and no .sln or .slnx file can be found in the resolved output folder. The code searches Directory.GetFiles for *.sln and *.slnx; if slnPath remains null, the command cannot determine the microservice solution name and aborts. The message suggests running inside a solution folder or using the -ms (MainSolution) parameter.","triggerScenarios":"Running a microservice service creation command in a directory that does not contain a .sln or .slnx file, without specifying the -ms parameter. slnPath == null after the file search.","commonSituations":"Developer runs the command from the wrong working directory (not the solution root), the solution file has a non-standard extension, or the microservice solution was not yet created. Also when -ms points to a path that itself lacks a solution file.","solutions":["Change to the directory containing your microservice .sln/.slnx file before running the command","Use the -ms parameter to point to the main solution path: `abp new ... -ms /path/to/MySolution.sln`","Ensure the solution file exists and uses the .sln or .slnx extension","If the microservice solution does not exist yet, create it first before adding services"],"exampleFix":"// before — run from wrong directory\nabp new MyMicroservice -t microservice-service\n\n// after\ncd /path/to/microservice-solution-root\nabp new MyMicroservice -t microservice-service\n// or specify explicitly\nabp new MyMicroservice -t microservice-service -ms /path/to/MySolution.sln","handlingStrategy":"validation","validationCode":"// Verify a solution file exists before running microservice commands\nvar slnFiles = Directory.GetFiles(workingDir, \"*.sln\")\n    .Concat(Directory.GetFiles(workingDir, \"*.slnx\"));\nif (!slnFiles.Any() && !commandLineArgs.Options.ContainsKey(Options.MainSolution.Short))\n{\n    Console.Error.WriteLine(\"Error: No .sln/.slnx found. Run from solution root or use -ms <path>.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await projectCreationCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"microservice solution\"))\n{\n    logger.LogError(\"Run inside the solution folder or pass -ms <solution-path>.\");\n}","preventionTips":["Always run microservice service commands from the solution root directory","Use the -ms parameter to explicitly specify the main solution path","Confirm the .sln or .slnx file exists before running"],"tags":["cli","abp-cli","project-creation","microservice","solution-structure"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}