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 23d8a8b5ff..170bf25dda 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 @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; using System.IO; +using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -48,17 +49,30 @@ namespace Volo.Abp.Cli.ProjectBuilding string templateSource = null) { + DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache); + var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); if (version == null) { - version = latestVersion ?? throw new CliUsageException( - "The remote service is currently unavailable, please specify the version (like abp new Acme.BookStore -v 2.3.0(Make sure you have a template cache locally))!"); + if (latestVersion == null) + { + Logger.LogWarning("The remote service is currently unavailable, please specify the version."); + Logger.LogWarning(string.Empty); + Logger.LogWarning("Find the following template in your cache directory: "); + + foreach (var cacheFile in Directory.GetFiles(CliPaths.TemplateCache)) + { + Logger.LogWarning($" {cacheFile}"); + } + + Logger.LogWarning(string.Empty); + throw new CliUsageException("Use command: abp new Acme.BookStore -v version"); + } + version = latestVersion; } var nugetVersion = (await GetTemplateNugetVersionAsync(name, type, version)) ?? version; - - DirectoryHelper.CreateIfNotExists(CliPaths.TemplateCache); - + if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) { Logger.LogInformation("Using local " + type + ": " + name + ", version: " + version); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs index eb5d8686d8..621631af2a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs @@ -61,9 +61,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Analyticses } catch (Exception ex) { - Console.WriteLine("Error occured while cli analytics from {0} : {1}", url, ex.Message); + // ignored } - } } } \ No newline at end of file