From 4afc251644bd6abcbe4a8bd1407270ae2d97edc0 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 13 Jan 2021 10:06:52 +0300 Subject: [PATCH] CLI: do not remove migrations for versions older than 4.2.0 related https://github.com/abpframework/abp/issues/7174 --- .../Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 27cfa0468b..55c7870f53 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 @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using NuGet.Versioning; using Volo.Abp.Cli.Commands; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building.Steps; @@ -277,7 +278,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App private static void RemoveMigrations(ProjectBuildContext context, List steps) { - steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations")); + if (string.IsNullOrWhiteSpace(context.BuildArgs.Version) || + SemanticVersion.Parse(context.BuildArgs.Version) > new SemanticVersion(4,1,99)) + { + steps.Add(new RemoveFolderStep("/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations")); + } } private static void CleanupFolderHierarchy(ProjectBuildContext context, List steps)