diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs index 5278a309ad..53a1f9bb1a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs @@ -104,8 +104,7 @@ public class BundlingService : IBundlingService, ITransientDependency scriptDefinitions = GenerateScriptDefinitions(scriptContext); } - var fileName = Path.Combine(PathHelper.GetWwwRootPath(directory), "index.html"); - + string fileName = null; if (bundleConfig.IsBlazorWebApp) { var projectDirectory = directory.RemovePostFix(".Client")!; @@ -117,11 +116,33 @@ public class BundlingService : IBundlingService, ITransientDependency { fileName = Path.Combine(projectDirectory, "App.razor"); } - else + + if (fileName.IsNullOrEmpty()) + { + // Single Template + var serverProjectDirectory = Path.Combine(Path.GetDirectoryName(directory), "Server"); + if (Directory.Exists(serverProjectDirectory)) + { + if (File.Exists(Path.Combine(serverProjectDirectory, "Components", "App.razor"))) + { + fileName = Path.Combine(serverProjectDirectory, "Components", "App.razor"); + } + else if (File.Exists(Path.Combine(serverProjectDirectory, "App.razor"))) + { + fileName = Path.Combine(projectDirectory, "App.razor"); + } + } + } + + if (projectDirectory.IsNullOrWhiteSpace()) { throw new BundlingException($"App.razor file could not be found on the {projectDirectory} project."); } } + else + { + fileName = Path.Combine(PathHelper.GetWwwRootPath(directory), "index.html"); + } await UpdateDependenciesInBlazorFileAsync(fileName, styleDefinitions, scriptDefinitions); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/Components/App.razor b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/Components/App.razor new file mode 100644 index 0000000000..f83a4f6fd3 --- /dev/null +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/Components/App.razor @@ -0,0 +1,45 @@ +@using Volo.Abp.Localization +@using System.Globalization +@using Microsoft.Extensions.Hosting +@using Volo.Abp.AspNetCore.Components.Server.Theming.Bundling +@using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling +@inject IHostEnvironment Env +@{ + var rtl = CultureHelper.IsRtl ? "rtl" : string.Empty; +} + + + + +
+ + +