diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index 506997ef9c..ae018a88c7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -431,8 +431,17 @@ public abstract class ProjectCreationCommandBase return; } + var isModuleTemplate = ModuleTemplateBase.IsModuleTemplate(projectArgs.TemplateName); var isWebassembly = projectArgs.UiFramework == UiFramework.Blazor; - var message = isWebassembly ? "Generating bundles for Blazor Wasm" : "Generating bundles for MAUI Blazor"; + + var message = isWebassembly || isModuleTemplate + ? "Generating bundles for Blazor Wasm" + : "Generating bundles for MAUI Blazor"; + + var projectType = isWebassembly || isModuleTemplate + ? BundlingConsts.WebAssembly + : BundlingConsts.MauiBlazor; + Logger.LogInformation(message + "..."); await EventBus.PublishAsync(new ProjectCreationProgressEvent @@ -440,19 +449,26 @@ public abstract class ProjectCreationCommandBase Message = message }, false); + var searchPattern = isWebassembly ? "*.Blazor.csproj" : "*.MauiBlazor.csproj"; var path = projectArgs.OutputFolder; - if (projectArgs.TemplateName == MicroserviceProTemplate.TemplateName) + + if (isModuleTemplate) + { + path = Path.Combine(path, "host"); + searchPattern = "*.Blazor.Host.csproj"; + } + else if (MicroserviceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName)) { path = Path.Combine(path, "apps"); } var directory = Path.GetDirectoryName( - Directory.GetFiles(path, isWebassembly ? "*.Blazor.csproj" : "*.MauiBlazor.csproj", SearchOption.AllDirectories).First() + Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories).First() ); - await _bundlingService.BundleAsync(directory, true, projectType: isWebassembly ? BundlingConsts.WebAssembly : BundlingConsts.MauiBlazor); + await _bundlingService.BundleAsync(directory, true, projectType); } - + protected virtual bool ShouldRunBundleCommand(ProjectBuildArgs projectArgs) { if ((AppTemplateBase.IsAppTemplate(projectArgs.TemplateName) || AppNoLayersTemplateBase.IsAppNoLayersTemplate(projectArgs.TemplateName)) @@ -461,7 +477,12 @@ public abstract class ProjectCreationCommandBase return true; } - if (projectArgs.TemplateName == MicroserviceProTemplate.TemplateName && projectArgs.UiFramework is UiFramework.Blazor) + if (MicroserviceServiceTemplateBase.IsMicroserviceTemplate(projectArgs.TemplateName) && projectArgs.UiFramework is UiFramework.Blazor) + { + return true; + } + + if (ModuleTemplateBase.IsModuleTemplate(projectArgs.TemplateName) && projectArgs.UiFramework != UiFramework.None) { return true; } diff --git a/framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs index b6a0195e27..7c9504a586 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions_Tests.cs @@ -22,27 +22,27 @@ public class AbpAuthorizationServiceExtensions_Tests : AuthorizationTestBase { var exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGranted); var errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("授权失败! 提供的策略尚未授予."); + errorInfo.Message.ShouldBe("授权失败!提供的策略尚未授予。"); exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedWithPolicyName) .WithData("PolicyName", "my_policy_name"); errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("授权失败! 提供的策略尚未授予: my_policy_name"); + errorInfo.Message.ShouldBe("授权失败!提供的策略尚未授予: my_policy_name"); exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource) .WithData("ResourceName", "my_resource_name"); errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("授权失败! 提供的策略未授予提供的资源: my_resource_name"); + errorInfo.Message.ShouldBe("授权失败!提供的策略未授予提供的资源:my_resource_name"); exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementHasNotGrantedForGivenResource) .WithData("ResourceName", "my_resource_name"); errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("授权失败! 提供的要求未授予提供的资源: my_resource_name"); + errorInfo.Message.ShouldBe("授权失败!提供的要求未授予提供的资源:my_resource_name"); exception = new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementsHasNotGrantedForGivenResource) .WithData("ResourceName", "my_resource_name"); errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("授权失败! 提供的要求未授予提供的资源: my_resource_name"); + errorInfo.Message.ShouldBe("授权失败!提供的要求未授予提供的资源:my_resource_name"); } } } diff --git a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs index 5917bde11d..bc45ada9ad 100644 --- a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs +++ b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs @@ -23,7 +23,7 @@ public class AbpGlobalFeatureNotEnableException_Localization_Test : GlobalFeatur .WithData("ServiceName", "MyService") .WithData("GlobalFeatureName", "TestFeature"); ; var errorInfo = _exceptionToErrorInfoConverter.Convert(exception); - errorInfo.Message.ShouldBe("'MyService'服务需要启用'TestFeature'功能."); + errorInfo.Message.ShouldBe("'MyService' 服务需要启用 'TestFeature'。"); } } }