diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index 257e12d0dc..84fe8324de 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -169,7 +169,15 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) { Logger.LogInformation("Using local " + type + ": " + name + ", version: " + version); - return new TemplateFile(File.ReadAllBytes(Path.Combine(templateSource, name + "-" + version + ".zip")), + + // A local template source can be a direct ".zip" file path or a folder that contains the "{name}-{version}.zip" file. + var localTemplateFilePath = templateSource.EndsWith(".zip", StringComparison.OrdinalIgnoreCase) + ? templateSource + : Path.Combine(templateSource, name.Replace("/", ".").EnsureEndsWith('-') + version + ".zip"); + + Logger.LogInformation("Using local template file: " + localTemplateFilePath); + + return new TemplateFile(File.ReadAllBytes(localTemplateFilePath), version, latestVersion, nugetVersion); } @@ -188,16 +196,6 @@ public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion, nugetVersion); } - if (!skipCache && !templateSource.IsNullOrWhiteSpace() && type == SourceCodeTypes.Template) - { - var templateFilePath = templateSource.EndsWith(".zip") - ? templateSource - : Path.Combine(templateSource, name.Replace("/", ".").EnsureEndsWith('-') + version + ".zip"); - - Logger.LogInformation("Using cached template: " + name + ", version: " + version + " from template source: " + templateFilePath); - return new TemplateFile(File.ReadAllBytes(templateFilePath), version, latestVersion, nugetVersion); - } - Logger.LogInformation("Downloading " + type + ": " + name + ", version: " + version); var fileContent = await DownloadSourceCodeContentAsync( diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 4a06557831..1a27ae84d0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -69,6 +69,7 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency args.Version, args.TemplateSource, args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long), + skipCache: args.SkipCache, trustUserVersion: args.TrustUserVersion );