{"record":{"id":"0983988274d03a76","repo":"abpframework/abp","slug":"you-can-only-create-a-new-preview-solution-with-pr","errorCode":null,"errorMessage":"You can only create a new preview solution with preview CLI version. Update your ABP CLI to the preview version.","messagePattern":"You can only create a new preview solution with preview CLI version\\. Update your ABP CLI to the preview version\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs","lineNumber":97,"sourceCode":"    {\n        var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);\n\n        if (version != null)\n        {\n            Logger.LogInformation($\"Version: {version}\");\n        }\n\n        var preview = commandLineArgs.Options.ContainsKey(Options.Preview.Long);\n        if (preview)\n        {\n            Logger.LogInformation(\"Preview: yes\");\n\n#if !DEBUG\n            var cliVersion = await CliVersionService.GetCurrentCliVersionAsync();\n\n            if (!cliVersion.IsPrerelease)\n            {\n                throw new CliUsageException(\n                    \"You can only create a new preview solution with preview CLI version.\" +\n                    \" Update your ABP CLI to the preview version.\");\n            }\n#endif\n        }\n\n        var pwa = commandLineArgs.Options.ContainsKey(Options.ProgressiveWebApp.Short);\n        if (pwa)\n        {\n            Logger.LogInformation(\"Progressive Web App: yes\");\n        }\n\n        var databaseProvider = GetDatabaseProvider(commandLineArgs);\n        if (databaseProvider != DatabaseProvider.NotSpecified)\n        {\n            Logger.LogInformation($\"Database provider: {databaseProvider}\");\n        }\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs#L79-L115","documentation":"Thrown by ProjectCreationCommandBase when the --preview flag is set but the installed ABP CLI version is not a prerelease/build. Under #if !DEBUG, the code fetches the current CLI version and checks cliVersion.IsPrerelease; if false, the user is told to update to a preview CLI. This prevents creating preview solutions with a stable CLI, which could generate incompatible template output.","triggerScenarios":"Running `abp new MyProject --preview` with a stable (non-preview) CLI build installed. CliVersionService.GetCurrentCliVersionAsync() returns a version whose IsPrerelease is false. In DEBUG builds this check is skipped.","commonSituations":"Developer installs the standard ABP CLI package but tries to scaffold a preview template. Version mismatch between the CLI and the template engine's preview expectations. Common when switching between stable and preview ABP versions.","solutions":["Update to the preview CLI: `dotnet tool update --global Volo.Abp.Studio.Cli --prerelease` (or the relevant preview package source)","Remove the --preview flag if you want to use the stable CLI: `abp new MyProject`","Verify the installed CLI version with `abp --version` and confirm it shows a prerelease suffix (e.g., -rc, -preview)"],"exampleFix":"// before\nabp new MyProject --preview\n// (running stable CLI)\n\n// after\ndotnet tool update --global Volo.Abp.Studio.Cli --prerelease\nabp new MyProject --preview","handlingStrategy":"validation","validationCode":"// Check CLI version before allowing preview solution creation\nvar cliVersion = await cliVersionService.GetCurrentCliVersionAsync();\nvar wantsPreview = commandLineArgs.Options.ContainsKey(Options.Preview.Long);\nif (wantsPreview && !cliVersion.IsPrerelease)\n{\n    Console.Error.WriteLine(\"Error: Preview solutions require a preview CLI. Update with --prerelease.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await projectCreationCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"preview solution with preview CLI\"))\n{\n    logger.LogError(\"Update CLI to preview: dotnet tool update -g Volo.Abp.Studio.Cli --prerelease\");\n}","preventionTips":["Match the CLI channel to your template channel: preview CLI for --preview, stable CLI otherwise","Check `abp --version` output for a prerelease suffix before using --preview","Document which CLI channel your team uses to avoid mismatch"],"tags":["cli","abp-cli","version-mismatch","project-creation","preview"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}