diff --git a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
index a6bb742585..ee064c4b67 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
+++ b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj
@@ -23,6 +23,7 @@
+
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
index a672b0b563..5b00d15c9e 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
@@ -8,12 +8,14 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
+using StackExchange.Redis;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Bundling;
using Volo.Abp.Cli.Commands.Services;
using Volo.Abp.Cli.LIbs;
using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Building;
+using Volo.Abp.Cli.ProjectBuilding.Templates.App;
using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection;
@@ -89,6 +91,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
var projectArgs = await GetProjectBuildArgsAsync(commandLineArgs, template, projectName);
+ await CheckCreatingRequirements(projectArgs);
+
var result = await TemplateProjectBuilder.BuildAsync(
projectArgs
);
@@ -97,6 +101,8 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
Logger.LogInformation($"'{projectName}' has been successfully created to '{projectArgs.OutputFolder}'");
+ await CheckCreatedRequirements(projectArgs);
+
ConfigureNpmPackagesForTheme(projectArgs);
await CreateOpenIddictPfxFilesAsync(projectArgs);
await RunGraphBuildForMicroserviceServiceTemplate(projectArgs);
@@ -120,6 +126,46 @@ public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransien
OpenRelatedWebPage(projectArgs, template, isTiered, commandLineArgs);
}
+ private Task CheckCreatingRequirements(ProjectBuildArgs projectArgs)
+ {
+ return Task.CompletedTask;
+ }
+
+ private async Task CheckCreatedRequirements(ProjectBuildArgs projectArgs)
+ {
+ var errors = new List();
+
+ if (projectArgs.ExtraProperties.ContainsKey("PreRequirements:Redis"))
+ {
+ var isConnected = false;
+ try
+ {
+ var redis = await ConnectionMultiplexer.ConnectAsync("127.0.0.1", options => options.ConnectTimeout = 3000);
+ isConnected = redis.IsConnected;
+ }
+ catch (Exception e)
+ {
+ // ignored
+ }
+ finally
+ {
+ if (!isConnected)
+ {
+ errors.Add("\t* Redis is not installed or not running on your computer.");
+ }
+ }
+ }
+
+ if (errors.Any())
+ {
+ Logger.LogWarning("NOTICE: The following tools are required to run your solution.");
+ foreach (var error in errors)
+ {
+ Logger.LogWarning(error);
+ }
+ }
+ }
+
public string GetUsageInfo()
{
var sb = new StringBuilder();
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
index 88bdc27973..d33aa103ba 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateInfo.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
+using Volo.Abp.Cli.ProjectBuilding.Templates;
namespace Volo.Abp.Cli.ProjectBuilding.Building;
@@ -28,7 +29,14 @@ public abstract class TemplateInfo
public virtual IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- return Array.Empty();
+ var steps = new List();
+ ConfigureCheckPreRequirements(context, steps);
+ return steps;
+ }
+
+ protected void ConfigureCheckPreRequirements(ProjectBuildContext context, List steps)
+ {
+ steps.Add(new CheckRedisPreRequirements());
}
public bool IsPro()
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
index ca5f5ceb61..edf8728305 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppNoLayersTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -20,7 +21,7 @@ public abstract class AppNoLayersTemplateBase : AppTemplateBase
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
switch (context.BuildArgs.DatabaseProvider)
{
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
index e8522f6f19..89f254e58b 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs
@@ -28,7 +28,7 @@ public abstract class AppTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
ConfigureTenantSchema(context, steps);
SwitchDatabaseProvider(context, steps);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs
new file mode 100644
index 0000000000..aee6da8f99
--- /dev/null
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/CheckRedisPreRequirements.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Linq;
+using Volo.Abp.Cli.ProjectBuilding.Building;
+
+namespace Volo.Abp.Cli.ProjectBuilding.Templates;
+
+public class CheckRedisPreRequirements : ProjectBuildPipelineStep
+{
+ public override void Execute(ProjectBuildContext context)
+ {
+ var modules = context.Files.Where(f => f.Name.EndsWith("Module.cs", StringComparison.OrdinalIgnoreCase));
+ if (modules.Any(module => module.Content.Contains("Redis:Configuration")))
+ {
+ context.BuildArgs.ExtraProperties["PreRequirements:Redis"] = "true";
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
index 13674458ee..e5ce4a0f84 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceServiceTemplateBase.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -33,14 +34,14 @@ public abstract class MicroserviceServiceTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedUiProject(context, steps);
SetRandomPortForHostProject(context, steps);
RandomizeStringEncryption(context, steps);
RandomizeAuthServerPassPhrase(context, steps);
ChangeConnectionString(context, steps);
-
+
return steps;
}
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
index b8d320fb45..cb7722da10 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -19,7 +20,7 @@ public abstract class MicroserviceTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedProjects(context, steps);
RandomizeStringEncryption(context, steps);
diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
index 5229bb167f..428c1061a1 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using JetBrains.Annotations;
using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Building.Steps;
@@ -21,7 +22,7 @@ public abstract class ModuleTemplateBase : TemplateInfo
public override IEnumerable GetCustomSteps(ProjectBuildContext context)
{
- var steps = new List();
+ var steps = base.GetCustomSteps(context).ToList();
DeleteUnrelatedProjects(context, steps);
RandomizeSslPorts(context, steps);