diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs
index 7a5f792b15..20e4f8fca6 100644
--- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs
+++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/CreateAppSettingsSecretsStep.cs
@@ -30,7 +30,9 @@ public class CreateAppSettingsSecretsStep : ProjectBuildPipelineStep
);
}
- var projectFiles = context.Files.Where(x => x.Content.Contains(AppSettingsPlaceholder)).ToList();
+ var projectFiles = context.Files.Where(x =>
+ x.Name.EndsWith(".csproj") &&
+ x.Content.Contains(AppSettingsPlaceholder)).ToList();
foreach (var projectFile in projectFiles)
{
@@ -66,11 +68,30 @@ public class CreateAppSettingsSecretsStep : ProjectBuildPipelineStep
private static string ReplaceAppSettingsSecretsPlaceholder(string content)
{
- var replaceContent = $"{Environment.NewLine}" +
- $" {Environment.NewLine}" +
+ var path = string.Empty;
+
+ var appSettingsRemoveLine = content.SplitToLines().FirstOrDefault(l=>
+ l.Contains("None") &&
+ l.Contains("Remove") &&
+ l.Contains(CliConsts.AppSettingsJsonFileName));
+
+ if (appSettingsRemoveLine != null)
+ {
+ var prefix = appSettingsRemoveLine.Split("\"")
+ .Select(s => s.Trim())
+ .First(s => s.Contains(CliConsts.AppSettingsJsonFileName))
+ .Replace(CliConsts.AppSettingsJsonFileName, "");
+
+ path = string.IsNullOrWhiteSpace(prefix) ? string.Empty : prefix;
+ }
+
+
+ var replaceContent = $"{Environment.NewLine}" +
+ $" {Environment.NewLine}" +
$" PreserveNewest{Environment.NewLine}" +
$" Always{Environment.NewLine}" +
" ";
+
return content.Replace(AppSettingsPlaceholder, replaceContent);
}
}
\ No newline at end of file