diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index 50108567e6..1b65577f1d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs @@ -1,4 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using System; +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; using System.Threading.Tasks; using Volo.Abp.Cli.Args; using Volo.Abp.Cli.Commands; @@ -8,6 +10,8 @@ namespace Volo.Abp.Cli { public class CliService : ITransientDependency { + public static string Version => typeof(AbpCliCoreModule).Assembly.GetFileVersion(); + protected ICommandLineArgumentParser CommandLineArgumentParser { get; } protected ICommandSelector CommandSelector { get; } public IHybridServiceScopeFactory ServiceScopeFactory { get; } @@ -24,6 +28,9 @@ namespace Volo.Abp.Cli public async Task RunAsync(string[] args) { + Console.WriteLine("ABP CLI (abp.io)"); + Console.WriteLine("Version: " + Version); + var commandLineArgs = CommandLineArgumentParser.Parse(args); var commandType = CommandSelector.Select(commandLineArgs); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/ProjectBuilding/ProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/ProjectBuilding/ProjectBuilder.cs index cc0f91940b..501d309845 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/ProjectBuilding/ProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/ProjectBuilding/ProjectBuilder.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; +using Volo.Abp.Cli; using Volo.Abp.DependencyInjection; using Volo.Abp.SolutionTemplating; using Volo.Abp.SolutionTemplating.Building; @@ -19,8 +20,6 @@ namespace Volo.Abp.ProjectBuilding public async Task BuildAsync(ProjectBuildArgs args) { - var version = "0.16.0"; //TODO: Should get from somewhere! - var templateInfo = GetTemplateInfo(args); args.TemplateName = templateInfo.Name; @@ -33,6 +32,8 @@ namespace Volo.Abp.ProjectBuilding } } + var version = CliService.Version; + var templateFile = await TemplateStore.GetAsync(args.TemplateName, version); var context = new ProjectBuildContext( diff --git a/framework/src/Volo.Abp.Core/System/Reflection/AbpAssemblyExtensions.cs b/framework/src/Volo.Abp.Core/System/Reflection/AbpAssemblyExtensions.cs new file mode 100644 index 0000000000..0e61770618 --- /dev/null +++ b/framework/src/Volo.Abp.Core/System/Reflection/AbpAssemblyExtensions.cs @@ -0,0 +1,12 @@ +using System.Diagnostics; + +namespace System.Reflection +{ + public static class AbpAssemblyExtensions + { + public static string GetFileVersion(this Assembly assembly) + { + return FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion; + } + } +}