Browse Source

Merge pull request #19968 from abpframework/blazor-binding-runtime

Unify the bundling system of `blazor server/wasm and mvc`.
pull/21687/head
maliming 1 year ago
committed by GitHub
parent
commit
a9e690066f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 208
      docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md
  2. BIN
      docs/en/Community-Articles/2024-11-25-Global-Assets/image.png
  3. 13
      framework/Volo.Abp.sln
  4. 34
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/AbpAspNetCoreComponentsMauiBlazorThemingModule.cs
  5. 3
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/FodyWeavers.xml
  6. 30
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/FodyWeavers.xsd
  7. 14
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiBlazorStandardBundles.cs
  8. 13
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiScriptContributor.cs
  9. 18
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiStyleContributor.cs
  10. 16
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling.csproj
  11. 4
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/AbpAspNetCoreComponentsMauiBlazorThemingModule.cs
  12. 4
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/ComponentsComponentsBundleContributor.cs
  13. 1
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.csproj
  14. 2
      framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/AbpAspNetCoreComponentsServerModule.cs
  15. 31
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpScripts.razor
  16. 29
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpStyles.razor
  17. 37
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule.cs
  18. 16
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyScriptContributor.cs
  19. 14
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyStandardBundles.cs
  20. 19
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyStyleContributor.cs
  21. 3
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/FodyWeavers.xml
  22. 30
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/FodyWeavers.xsd
  23. 16
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling.csproj
  24. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/AbpAspNetCoreComponentsWebAssemblyThemingModule.cs
  25. 4
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/ComponentsComponentsBundleContributor.cs
  26. 1
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.csproj
  27. 20
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingGlobalAssetsOptions.cs
  28. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingOptions.cs
  29. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs
  30. 20
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleParameterDictionary.cs
  31. 107
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs
  32. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  33. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs
  34. 3
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
  35. 76
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/Styles/CssRelativePathAdjuster.cs
  36. 3
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/Styles/StyleBundler.cs
  37. 40
      framework/src/Volo.Abp.Core/Volo/Abp/Bundling/Styles/CssRelativePath.cs
  38. 7
      modules/basic-theme/Volo.Abp.BasicTheme.sln
  39. 20
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule.cs
  40. 12
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/BasicThemeBundleStyleContributor.cs
  41. 3
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/FodyWeavers.xml
  42. 30
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/FodyWeavers.xsd
  43. 15
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling.csproj
  44. 2
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/AbpAspNetCoreComponentsWebAssemblyBasicThemeModule.cs
  45. 4
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/BasicThemeBundleContributor.cs
  46. 1
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.csproj
  47. 5
      nupkg/common.ps1
  48. 4
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj
  49. 4
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
  50. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/MyCompanyName.MyProjectName.Blazor.WebAssembly.Client.csproj
  51. 13
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/MyProjectNameBundleContributor.cs
  52. 10
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/appsettings.json
  53. 30
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.css
  54. 37
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.js
  55. 9
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/Components/App.razor
  56. 3
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyCompanyName.MyProjectName.Blazor.WebAssembly.Server.Mongo.csproj
  57. 4
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs
  58. 9
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Components/App.razor
  59. 3
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyCompanyName.MyProjectName.Blazor.WebAssembly.Server.csproj
  60. 6
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs
  61. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj
  62. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj
  63. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj
  64. 2
      templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj
  65. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
  66. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyCompanyName.MyProjectName.Blazor.Client.csproj
  67. 1
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyProjectNameBlazorClientModule.cs
  68. 13
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyProjectNameBundleContributor.cs
  69. 10
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/appsettings.json
  70. 30
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.css
  71. 37
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.js
  72. 4
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj
  73. 4
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj
  74. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/MyCompanyName.MyProjectName.Blazor.WebApp.Client.csproj
  75. 13
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/MyProjectNameBundleContributor.cs
  76. 11
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/appsettings.json
  77. 17
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.css
  78. 37
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.js
  79. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client.csproj
  80. 13
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/MyProjectNameBundleContributor.cs
  81. 11
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/appsettings.json
  82. 17
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.css
  83. 37
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.js
  84. 4
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.csproj
  85. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs
  86. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyCompanyName.MyProjectName.Blazor.WebApp.csproj
  87. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs
  88. 8
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/App.razor
  89. 8
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj
  90. 63
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs
  91. 86
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs
  92. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj
  93. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj
  94. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj
  95. 7
      templates/module/aspnet-core/MyCompanyName.MyProjectName.sln
  96. 16
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/MyProjectNameBlazorHostBundleContributor.cs
  97. 22
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.css
  98. 9
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.js
  99. 10
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/App.razor
  100. 8
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj

208
docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md

@ -0,0 +1,208 @@
# ABP Global Assets - New way to bundle JavaScript/CSS files in Blazor WebAssembly app
We have introduced a new feature in the ABP framework to bundle the `JavaScript/CSS` files in the Blazor wasm app. This feature is called `Global Assets`.
With this feature, you don't need to run the `abp bundle` command to manually create/maintain the `global.js` and `global.css` files in your Blazor wasm app.
## How Global Assets works?
The new `Blazor wasm app` has two projects:
1. `MyProjectName` (ASP.NET Core app)
2. `MyProjectName.Client` (Blazor wasm app)
The `MyProjectName` reference the `MyProjectName.Client` project, and will be the entry point of the application, which means the `MyProjectName` project will be the `host` project of the `MyProjectName.Client` project.
The static/virtual files of `MyProjectName` can be accessed by the `MyProjectName.Client` project, so we can create dynamic global assets in the `MyProjectName` project and use them in the `MyProjectName.Client` project.
## How it works in ABP?
We have created a new package `WebAssembly.Theme.Bundling` for the theme `WebAssembly` module and used the `Volo.Abp.AspNetCore.Mvc.UI.Bundling.BundleContributor` to add `JavaScript/CSS` files to the bundling system.
* LeptonXLiteTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule`
* LeptonXTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule`
* LeptonTheme: `AbpAspNetCoreComponentsWebAssemblyLeptonThemeBundlingModule`
* BasicTheme: `AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule`
The new `ThemeBundlingModule` only depends on `AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule(new package)`. It's an `abstractions module`, which only depends on `AbpAspNetCoreMvcUiBundlingAbstractionsModule`.
We will get all `JavaScript/CSS` files on `OnApplicationInitializationAsync` method of `AbpAspNetCoreMvcUiBundlingModule` from bundling system and add them to `IDynamicFileProvider` service. After that, we can access the `JavaScript/CSS` files in the Blazor wasm app.
## Add the Global Assets in the module
If your module has `JavaScript/CSS` files that need to the bundling system, You have to create a new project(`YourModuleName.Blazor.WebAssembly.Bundling`) to your module solution, and reference the new project in the `MyProjectName` project and module dependencies.
The new project should **only** depend on the `AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule` and define `BundleContributor` classes to contribute the `JavaScript/CSS` files.
> Q: The new project(`YourModuleName.Blazor.WebAssembly.Bundling`) doesn't have the `libs/myscript.js` and `libs/myscript.css` files why the files can be added to the bundling system?
> A: Because the `MyProjectName.Client` will depend on the `MyBlazorModule(YourModuleName.Blazor)` that contains the `JavaScript/CSS` files, The `MyProjectName` is referencing the `MyProjectName.Client` project, so the `MyProjectName` project can access the `JavaScript/CSS` files in the `MyProjectName.Client` project and add them to the bundling system.
```csharp
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule)
)]
public class MyBlazorWebAssemblyBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
// Script Bundles
options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global).AddContributors(typeof(MyModuleBundleScriptContributor));
// Style Bundles
options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global).AddContributors(typeof(MyModuleBundleStyleBundleContributor));
});
}
}
```
```csharp
public class MyModuleBundleScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/myscript.js");
}
}
public class MyModuleBundleStyleBundleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/MyModule.Blazor/libs/myscript.css");
}
}
```
## Use the Global Assets in the Blazor wasm app
### MyProject
Convert your `MyProject` project to integrate the `ABP module` system and depend on the `AbpAspNetCoreMvcUiBundlingModule` and `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule`:
> If the `BlazorWebAssembly modules` in `MyProject.Client` contain `BundleContributor`, Please also add the `BlazorWebAssemblyBundlingModule` of the module to the `MyProject` project.
* The `AbpAspNetCoreMvcUiBundlingModule` uses to create the `JavaScript/CSS` files to virtual files.
* The `AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule` uses to add theme `JavaScript/CSS` to the bundling system.
Here is how your project files look like:
**`Program.cs`:**
```csharp
public class Program
{
public async static Task<int> Main(string[] args)
{
//...
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<MyProjectNameBlazorModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
//...
}
}
```
**`MyProjectNameBlazorModule.cs`:**
```csharp
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMvcUiBundlingModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule) //Should be added!
)]
public class MyProjectNameBlazorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//https://github.com/dotnet/aspnetcore/issues/52530
Configure<RouteOptions>(options =>
{
options.SuppressCheckForUnhandledSecurityMetadata = true;
});
// Add services to the container.
context.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
// Configure the HTTP request pipeline.
if (env.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.MapAbpStaticAssets();
app.UseRouting();
app.UseAntiforgery();
app.UseConfiguredEndpoints(builder =>
{
builder.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(WebAppAdditionalAssembliesHelper.GetAssemblies<MyProjectNameBlazorClientModule>());
});
}
}
```
**`MyProjectName.csproj`:**
```xml
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="9.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Bundling" Version="9.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="9.0.0" />
<ProjectReference Include="..\MyProjectName.Blazor.Client\MyProjectName.Blazor.Client.csproj" />
</ItemGroup>
```
### MyProjectName.Client
1. Remove the `global.JavaScript/CSS` files from the `MyProjectName.Client`'s `wwwroot` folder.
2. Refactor all BundleContributor classes that inherit from `IBundleContributor` to inherit from `BundleContributor` instead.
3. Remove the `AbpCli:Bundle` section from the `appsettings.json` file.
### Check the Global Assets
Run the `MyProject` project and check the `https://localhost/global.js` and `https://localhost/global.css` files. You should be able to see the `JavaScript/CSS` files content from the Bundling system:
![global](image.png)
## GlobalAssets(AbpBundlingGlobalAssetsOptions)
You can configure the JavaScript and CSS file names in the `GlobalAssets` property of the `AbpBundlingOptions` class.
The default values are `global.js` and `global.css`.
## Conclusion
With the new `Global Assets` feature, you can easily bundle the `JavaScript/CSS` files in the Blazor wasm app. This feature is very useful for the Blazor wasm app, and it will save you a lot of time and effort. We hope you will enjoy this feature and use it in your projects.
## References
* [Virtual Files](https://docs.abp.io/en/abp/latest/Virtual-Files)
* [Bundle Contributors](https://abp.io/docs/latest/framework/ui/mvc-razor-pages/bundling-minification#bundle-contributors)
* [Global Assets Pull Request](https://github.com/abpframework/abp/pull/19968)

BIN
docs/en/Community-Articles/2024-11-25-Global-Assets/image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

13
framework/Volo.Abp.sln

@ -467,6 +467,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.RemoteServices.Tes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Abstractions", "src\Volo.Abp.AspNetCore.Abstractions\Volo.Abp.AspNetCore.Abstractions.csproj", "{E1051CD0-9262-4869-832D-B951723F4DDE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling", "src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling.csproj", "{2F9BA650-395C-4BE0-8CCB-9978E753562A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling", "src\Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling\Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling.csproj", "{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BlobStoring.Google", "src\Volo.Abp.BlobStoring.Google\Volo.Abp.BlobStoring.Google.csproj", "{DEEB5200-BBF9-464D-9B7E-8FC035A27E94}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BlobStoring.Google.Tests", "test\Volo.Abp.BlobStoring.Google.Tests\Volo.Abp.BlobStoring.Google.Tests.csproj", "{40FB8907-9CF7-44D0-8B5F-538AC6DAF8B9}"
@ -1403,6 +1406,14 @@ Global
{E1051CD0-9262-4869-832D-B951723F4DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1051CD0-9262-4869-832D-B951723F4DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1051CD0-9262-4869-832D-B951723F4DDE}.Release|Any CPU.Build.0 = Release|Any CPU
{2F9BA650-395C-4BE0-8CCB-9978E753562A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F9BA650-395C-4BE0-8CCB-9978E753562A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F9BA650-395C-4BE0-8CCB-9978E753562A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F9BA650-395C-4BE0-8CCB-9978E753562A}.Release|Any CPU.Build.0 = Release|Any CPU
{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D}.Release|Any CPU.Build.0 = Release|Any CPU
{DEEB5200-BBF9-464D-9B7E-8FC035A27E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEEB5200-BBF9-464D-9B7E-8FC035A27E94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEEB5200-BBF9-464D-9B7E-8FC035A27E94}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -1658,6 +1669,8 @@ Global
{DFAF8763-D1D6-4EB4-B459-20E31007FE2F} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{DACD4485-61BE-4DE5-ACAE-4FFABC122500} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{E1051CD0-9262-4869-832D-B951723F4DDE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{2F9BA650-395C-4BE0-8CCB-9978E753562A} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{7ADB6D92-82CC-4A2A-8BCF-FC6C6308796D} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{DEEB5200-BBF9-464D-9B7E-8FC035A27E94} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{40FB8907-9CF7-44D0-8B5F-538AC6DAF8B9} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{E50739A7-5E2F-4EB5-AEA9-554115CB9613} = {447C8A77-E5F0-4538-8687-7383196D04EA}

34
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/AbpAspNetCoreComponentsMauiBlazorThemingModule.cs

@ -0,0 +1,34 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling;
[DependsOn(
typeof(AbpAspNetCoreMvcUiBundlingAbstractionsModule)
)]
public class AbpAspNetCoreComponentsMauiBlazorThemingBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
options.GlobalAssets.Enabled = true;
options.GlobalAssets.GlobalStyleBundleName = MauiBlazorStandardBundles.Styles.Global;
options.GlobalAssets.GlobalScriptBundleName = MauiBlazorStandardBundles.Scripts.Global;
options
.StyleBundles
.Add(MauiBlazorStandardBundles.Styles.Global, bundle =>
{
bundle.AddContributors(typeof(MauiStyleContributor));
});
options
.ScriptBundles
.Add(MauiBlazorStandardBundles.Scripts.Global, bundle =>
{
bundle.AddContributors(typeof(MauiScriptContributor));
});
});
}
}

3
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

14
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiBlazorStandardBundles.cs

@ -0,0 +1,14 @@
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling;
public class MauiBlazorStandardBundles
{
public static class Styles
{
public static string Global = "MauiBlazor.Global";
}
public static class Scripts
{
public static string Global = "MauiBlazor.Global";
}
}

13
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiScriptContributor.cs

@ -0,0 +1,13 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling;
public class MauiScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/lang-utils.js");
}
}

18
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/MauiStyleContributor.cs

@ -0,0 +1,18 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling;
public class MauiStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/libs/bootstrap/css/bootstrap.min.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/libs/fontawesome/css/all.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/css/abp.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/libs/flag-icon/css/flag-icon.css");
context.Files.AddIfNotContains("_content/Blazorise/blazorise.css");
context.Files.AddIfNotContains("_content/Blazorise.Bootstrap5/blazorise.bootstrap5.css");
context.Files.AddIfNotContains("_content/Blazorise.Snackbar/blazorise.snackbar.css");
}
}

16
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling.csproj

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions\Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj" />
</ItemGroup>
</Project>

4
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/AbpAspNetCoreComponentsMauiBlazorThemingModule.cs

@ -1,9 +1,11 @@
using Volo.Abp.AspNetCore.Components.Web.Theming;
using Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming;
[DependsOn(
typeof(AbpAspNetCoreComponentsMauiBlazorThemingBundlingModule),
typeof(AbpAspNetCoreComponentsWebThemingModule),
typeof(AbpAspNetCoreComponentsMauiBlazorModule)
)]

4
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/ComponentsComponentsBundleContributor.cs

@ -1,7 +1,9 @@
using Volo.Abp.Bundling;
using System;
using Volo.Abp.Bundling;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming;
[Obsolete("This class is obsolete and will be removed in the future versions. Use GlobalAssets instead.")]
public class ComponentsComponentsBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)

1
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.csproj

@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling\Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.MauiBlazor\Volo.Abp.AspNetCore.Components.MauiBlazor.csproj" />
</ItemGroup>

2
framework/src/Volo.Abp.AspNetCore.Components.Server/Volo/Abp/AspNetCore/Components/Server/AbpAspNetCoreComponentsServerModule.cs

@ -2,7 +2,6 @@
using System.Net;
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
using Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
@ -31,7 +30,6 @@ public class AbpAspNetCoreComponentsServerModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
StaticWebAssetsLoader.UseStaticWebAssets(context.Services.GetHostingEnvironment(), context.Services.GetConfiguration());
context.Services.AddHttpClient(nameof(BlazorServerLookupApiRequestService))
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
{

31
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpScripts.razor

@ -1,8 +1,4 @@
@using Volo.Abp
@implements IDisposable
@inject IComponentBundleManager BundleManager
@inject PersistentComponentState PersistentComponentState
@if (ScriptFiles != null)
{
foreach (var file in ScriptFiles)
@ -20,37 +16,18 @@
private List<string>? ScriptFiles { get; set; }
private PersistingComponentStateSubscription persistingSubscription;
protected override async Task OnInitializedAsync()
{
if (BundleName == null)
{
throw new AbpException("The BundleName parameter of the AbpScripts component can not be null!");
}
persistingSubscription = PersistentComponentState.RegisterOnPersisting(PersistScriptFiles);
ScriptFiles = new List<string>();
if (PersistentComponentState.TryTakeFromJson<List<string>>(nameof(ScriptFiles), out var restoredStyleFiles))
{
ScriptFiles = restoredStyleFiles;
}
else
if (!BundleName.IsNullOrWhiteSpace())
{
ScriptFiles = (await BundleManager.GetScriptBundleFilesAsync(BundleName!)).ToList();
}
if (WebAssemblyScriptFiles != null)
if (OperatingSystem.IsBrowser() && WebAssemblyScriptFiles != null)
{
ScriptFiles?.AddRange(WebAssemblyScriptFiles);
ScriptFiles.AddIfNotContains(WebAssemblyScriptFiles);
}
}
private Task PersistScriptFiles()
{
PersistentComponentState.PersistAsJson(nameof(ScriptFiles), ScriptFiles);
return Task.CompletedTask;
}
public void Dispose() => persistingSubscription.Dispose();
}

29
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming/Bundling/AbpStyles.razor

@ -1,8 +1,4 @@
@using Volo.Abp
@implements IDisposable
@inject IComponentBundleManager BundleManager
@inject PersistentComponentState PersistentComponentState
@if (StyleFiles != null)
{
foreach (var file in StyleFiles)
@ -20,37 +16,18 @@
private List<string>? StyleFiles { get; set; }
private PersistingComponentStateSubscription persistingSubscription;
protected override async Task OnInitializedAsync()
{
if (BundleName == null)
{
throw new AbpException("The BundleName parameter of the AbpStyles component can not be null!");
}
persistingSubscription = PersistentComponentState.RegisterOnPersisting(PersistStyleFiles);
StyleFiles = new List<string>();
if (PersistentComponentState.TryTakeFromJson<List<string>>(nameof(StyleFiles), out var restoredStyleFiles))
{
StyleFiles = restoredStyleFiles;
}
else
if (!BundleName.IsNullOrWhiteSpace())
{
StyleFiles = (await BundleManager.GetStyleBundleFilesAsync(BundleName!)).ToList();
}
if (OperatingSystem.IsBrowser() && WebAssemblyStyleFiles != null)
{
StyleFiles?.AddRange(WebAssemblyStyleFiles);
StyleFiles.AddIfNotContains(WebAssemblyStyleFiles);
}
}
private Task PersistStyleFiles()
{
PersistentComponentState.PersistAsJson(nameof(StyleFiles), StyleFiles);
return Task.CompletedTask;
}
public void Dispose() => persistingSubscription.Dispose();
}

37
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule.cs

@ -0,0 +1,37 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
[DependsOn(
typeof(AbpAspNetCoreMvcUiBundlingAbstractionsModule)
)]
public class AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
options.GlobalAssets.Enabled = true;
options.GlobalAssets.GlobalStyleBundleName = BlazorWebAssemblyStandardBundles.Styles.Global;
options.GlobalAssets.GlobalScriptBundleName = BlazorWebAssemblyStandardBundles.Scripts.Global;
options
.StyleBundles
.Add(BlazorWebAssemblyStandardBundles.Styles.Global, bundle =>
{
bundle.AddContributors(typeof(BlazorWebAssemblyStyleContributor));
});
options
.ScriptBundles
.Add(BlazorWebAssemblyStandardBundles.Scripts.Global, bundle =>
{
bundle.AddContributors(typeof(BlazorWebAssemblyScriptContributor));
});
options.MinificationIgnoredFiles.Add("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
});
}
}

16
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyScriptContributor.cs

@ -0,0 +1,16 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
public class BlazorWebAssemblyScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/lang-utils.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/lang-utils.js");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/authentication-state-listener.js");
}
}

14
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyStandardBundles.cs

@ -0,0 +1,14 @@
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
public class BlazorWebAssemblyStandardBundles
{
public static class Styles
{
public static string Global = "BlazorWebAssembly.Global";
}
public static class Scripts
{
public static string Global = "BlazorWebAssembly.Global";
}
}

19
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/BlazorWebAssemblyStyleContributor.cs

@ -0,0 +1,19 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
public class BlazorWebAssemblyStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/libs/bootstrap/css/bootstrap.min.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/libs/fontawesome/css/all.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/css/abp.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/libs/flag-icon/css/flag-icon.css");
context.Files.AddIfNotContains("_content/Blazorise/blazorise.css");
context.Files.AddIfNotContains("_content/Blazorise.Bootstrap5/blazorise.bootstrap5.css");
context.Files.AddIfNotContains("_content/Blazorise.Snackbar/blazorise.snackbar.css");
context.Files.AddIfNotContains("_content/Volo.Abp.BlazoriseUI/volo.abp.blazoriseui.css");
}
}

3
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

16
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling.csproj

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions\Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions.csproj" />
</ItemGroup>
</Project>

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/AbpAspNetCoreComponentsWebAssemblyThemingModule.cs

@ -1,9 +1,11 @@
using Volo.Abp.AspNetCore.Components.Web.Theming;
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming;
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule),
typeof(AbpAspNetCoreComponentsWebThemingModule),
typeof(AbpAspNetCoreComponentsWebAssemblyModule)
)]

4
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/ComponentsComponentsBundleContributor.cs

@ -1,7 +1,9 @@
using Volo.Abp.Bundling;
using System;
using Volo.Abp.Bundling;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.Theming;
[Obsolete("This class is obsolete and will be removed in the future versions. Use GlobalAssets instead.")]
public class ComponentsComponentsBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)

1
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.csproj

@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.WebAssembly\Volo.Abp.AspNetCore.Components.WebAssembly.csproj" />
</ItemGroup>

20
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingGlobalAssetsOptions.cs

@ -0,0 +1,20 @@
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
public class AbpBundlingGlobalAssetsOptions
{
public bool Enabled { get; set; }
public string? GlobalStyleBundleName { get; set; }
public string? GlobalScriptBundleName { get; set; }
public string JavaScriptFileName { get; set; }
public string CssFileName { get; set; }
public AbpBundlingGlobalAssetsOptions()
{
JavaScriptFileName = "global.js";
CssFileName = "global.css";
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpBundlingOptions.cs

@ -28,6 +28,10 @@ public class AbpBundlingOptions
public List<string> PreloadStyles { get; }
public AbpBundlingGlobalAssetsOptions GlobalAssets { get; set; }
public BundleParameterDictionary Parameters { get; set; }
public AbpBundlingOptions()
{
StyleBundles = new BundleConfigurationCollection();
@ -37,5 +41,7 @@ public class AbpBundlingOptions
DeferScripts = new List<string>();
PreloadStylesByDefault = false;
PreloadStyles = new List<string>();
GlobalAssets = new AbpBundlingGlobalAssetsOptions();
Parameters = new BundleParameterDictionary();
}
}

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationContext.cs

@ -16,11 +16,14 @@ public class BundleConfigurationContext : IBundleConfigurationContext
public IAbpLazyServiceProvider LazyServiceProvider { get; }
public BundleConfigurationContext(IServiceProvider serviceProvider, IFileProvider fileProvider)
public BundleParameterDictionary Parameters { get; set; }
public BundleConfigurationContext(IServiceProvider serviceProvider, IFileProvider fileProvider, BundleParameterDictionary? parameters = null)
{
Files = new List<BundleFile>();
ServiceProvider = serviceProvider;
LazyServiceProvider = ServiceProvider.GetRequiredService<IAbpLazyServiceProvider>();
FileProvider = fileProvider;
Parameters = parameters ?? new BundleParameterDictionary();
}
}

20
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleParameterDictionary.cs

@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
public class BundleParameterDictionary : Dictionary<string, string>
{
public const string InteractiveAutoPropertyName = "InteractiveAuto";
public bool InteractiveAuto
{
get
{
return TryGetValue(InteractiveAutoPropertyName, out var value) && bool.Parse(value);
}
set
{
this[InteractiveAutoPropertyName] = value.ToString();
}
}
}

107
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs

@ -1,8 +1,21 @@
using Volo.Abp.AspNetCore.Mvc.Libs;
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.Bundling.Styles;
using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.Data;
using Volo.Abp.Minify;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
@ -23,4 +36,96 @@ public class AbpAspNetCoreMvcUiBundlingModule : AbpModule
});
}
}
public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
var environment = context.GetEnvironmentOrNull();
if (environment != null)
{
environment.WebRootFileProvider =
new CompositeFileProvider(
context.GetEnvironment().WebRootFileProvider,
context.ServiceProvider.GetRequiredService<IWebContentFileProvider>()
);
}
await InitialGlobalAssetsAsync(context);
}
protected virtual async Task InitialGlobalAssetsAsync(ApplicationInitializationContext context)
{
var bundlingOptions = context.ServiceProvider.GetRequiredService<IOptions<AbpBundlingOptions>>().Value;
var logger = context.ServiceProvider.GetRequiredService<ILogger<AbpAspNetCoreMvcUiBundlingModule>>();
if (!bundlingOptions.GlobalAssets.Enabled)
{
return;
}
var bundleManager = context.ServiceProvider.GetRequiredService<BundleManager>();
var webHostEnvironment = context.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
var dynamicFileProvider = context.ServiceProvider.GetRequiredService<IDynamicFileProvider>();
if (!bundlingOptions.GlobalAssets.GlobalStyleBundleName.IsNullOrWhiteSpace())
{
var styleFiles = await bundleManager.GetStyleBundleFilesAsync(bundlingOptions.GlobalAssets.GlobalStyleBundleName);
var styles = string.Empty;
foreach (var file in styleFiles)
{
var fileInfo = webHostEnvironment.WebRootFileProvider?.GetFileInfo(file.FileName);
if (fileInfo == null || !fileInfo.Exists)
{
logger.LogError($"Could not find the file: {file.FileName}");
continue;
}
var fileContent = await fileInfo.ReadAsStringAsync();
if (!bundleManager.IsBundlingEnabled())
{
fileContent = CssRelativePath.Adjust(fileContent,
file.FileName,
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"));
styles += $"/*{file.FileName}*/{Environment.NewLine}{fileContent}{Environment.NewLine}{Environment.NewLine}";
}
else
{
styles += $"{fileContent}{Environment.NewLine}{Environment.NewLine}";
}
}
dynamicFileProvider.AddOrUpdate(
new InMemoryFileInfo("/wwwroot/" + bundlingOptions.GlobalAssets.CssFileName,
Encoding.UTF8.GetBytes(styles),
bundlingOptions.GlobalAssets.CssFileName));
}
if (!bundlingOptions.GlobalAssets.GlobalScriptBundleName.IsNullOrWhiteSpace())
{
var scriptFiles = await bundleManager.GetScriptBundleFilesAsync(bundlingOptions.GlobalAssets.GlobalScriptBundleName);
var scripts = string.Empty;
foreach (var file in scriptFiles)
{
var fileInfo = webHostEnvironment.WebRootFileProvider?.GetFileInfo(file.FileName);
if (fileInfo == null || !fileInfo.Exists)
{
logger.LogError($"Could not find the file: {file.FileName}");
continue;
}
var fileContent = await fileInfo.ReadAsStringAsync();
if (!bundleManager.IsBundlingEnabled())
{
scripts += $"{fileContent.EnsureEndsWith(';')}{Environment.NewLine}{Environment.NewLine}";
}
else
{
scripts += $"//{file.FileName}{Environment.NewLine}{fileContent.EnsureEndsWith(';')}{Environment.NewLine}{Environment.NewLine}";
}
}
dynamicFileProvider.AddOrUpdate(
new InMemoryFileInfo("/wwwroot/" + bundlingOptions.GlobalAssets.JavaScriptFileName,
Encoding.UTF8.GetBytes(scripts),
bundlingOptions.GlobalAssets.JavaScriptFileName));
}
}
}

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs

@ -172,7 +172,7 @@ public class BundleManager : IBundleManager, ITransientDependency
);
}
protected virtual bool IsBundlingEnabled()
public virtual bool IsBundlingEnabled()
{
switch (Options.Mode)
{
@ -240,7 +240,7 @@ public class BundleManager : IBundleManager, ITransientDependency
protected virtual BundleConfigurationContext CreateBundleConfigurationContext()
{
return new BundleConfigurationContext(ServiceProvider, HostingEnvironment.WebRootFileProvider);
return new BundleConfigurationContext(ServiceProvider, HostingEnvironment.WebRootFileProvider, Options.Parameters);
}
protected virtual List<IBundleContributor> GetContributors(BundleConfigurationCollection bundles, string bundleName)

2
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs

@ -2,6 +2,8 @@ using System;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.Bundling.Styles;
using Volo.Abp.Minify.Styles;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Styles;

3
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs

@ -1,5 +1,6 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
using Microsoft.AspNetCore.RequestLocalization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
@ -56,6 +57,8 @@ public class AbpAspNetCoreModule : AbpModule
AddAspNetServices(context.Services);
context.Services.AddObjectAccessor<IApplicationBuilder>();
context.Services.AddAbpDynamicOptions<RequestLocalizationOptions, AbpRequestLocalizationOptionsManager>();
StaticWebAssetsLoader.UseStaticWebAssets(context.Services.GetHostingEnvironment(), context.Services.GetConfiguration());
}
private static void AddAspNetServices(IServiceCollection services)

76
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/Styles/CssRelativePathAdjuster.cs

@ -1,76 +0,0 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
namespace Volo.Abp.Cli.Bundling.Styles;
internal static class CssRelativePathAdjuster
{
private static readonly Regex _rxUrl = new Regex(@"url\s*\(\s*([""']?)([^:)]+)\1\s*\)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static string Adjust(
string cssFileContents,
string absoluteInputFilePath,
string absoluteOutputPath)
{
var matches = _rxUrl.Matches(cssFileContents);
if (matches.Count <= 0)
{
return cssFileContents;
}
var cssDirectoryPath = Path.GetDirectoryName(absoluteInputFilePath);
foreach (Match match in matches)
{
string quoteDelimiter = match.Groups[1].Value; //url('') vs url("")
string relativePathToCss = match.Groups[2].Value;
// Ignore root relative references
if (relativePathToCss.StartsWith("/", StringComparison.Ordinal))
continue;
//prevent query string from causing error
var pathAndQuery = relativePathToCss.Split(new[] { '?' }, 2, StringSplitOptions.RemoveEmptyEntries);
var pathOnly = pathAndQuery[0];
var queryOnly = pathAndQuery.Length == 2 ? pathAndQuery[1] : string.Empty;
string absolutePath = GetAbsolutePath(cssDirectoryPath, pathOnly);
string serverRelativeUrl = MakeRelative(absoluteOutputPath, absolutePath);
if (!string.IsNullOrEmpty(queryOnly))
serverRelativeUrl += "?" + queryOnly;
string replace = string.Format("url({0}{1}{0})", quoteDelimiter, serverRelativeUrl);
cssFileContents = cssFileContents.Replace(match.Groups[0].Value, replace);
}
return cssFileContents;
}
private static string GetAbsolutePath(string cssFilePath, string pathOnly)
{
return Path.GetFullPath(Path.Combine(cssFilePath, pathOnly));
}
private static readonly string _protocol = "file:///";
private static string MakeRelative(string baseFile, string file)
{
if (string.IsNullOrEmpty(file))
return file;
Uri baseUri = new Uri(_protocol + baseFile, UriKind.RelativeOrAbsolute);
Uri fileUri = new Uri(_protocol + file, UriKind.RelativeOrAbsolute);
if (baseUri.IsAbsoluteUri)
{
return Uri.UnescapeDataString(baseUri.MakeRelativeUri(fileUri).ToString());
}
else
{
return baseUri.ToString();
}
}
}

3
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/Styles/StyleBundler.cs

@ -2,6 +2,7 @@
using System.IO;
using System.Text;
using Volo.Abp.Bundling;
using Volo.Abp.Bundling.Styles;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Minify.Styles;
@ -44,7 +45,7 @@ public class StyleBundler : BundlerBase, IStyleBundler, ITransientDependency
protected override string ProcessBeforeAddingToTheBundle(string referencePath, string bundleDirectory,
string fileContent)
{
return CssRelativePathAdjuster.Adjust(
return CssRelativePath.Adjust(
fileContent,
referencePath,
bundleDirectory

40
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/CssRelativePath.cs → framework/src/Volo.Abp.Core/Volo/Abp/Bundling/Styles/CssRelativePath.cs

@ -2,18 +2,18 @@
using System.IO;
using System.Text.RegularExpressions;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Styles;
namespace Volo.Abp.Bundling.Styles;
internal static class CssRelativePath
public static class CssRelativePath
{
private static readonly Regex _rxUrl = new Regex(@"url\s*\(\s*([""']?)([^:)]+)\1\s*\)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly static Regex RxUrl = new Regex(@"url\s*\(\s*([""']?)([^:)]+)\1\s*\)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static string Adjust(
string cssFileContents,
string absoluteInputFilePath,
string absoluteOutputPath)
{
var matches = _rxUrl.Matches(cssFileContents);
var matches = RxUrl.Matches(cssFileContents);
if (matches.Count <= 0)
{
@ -24,25 +24,29 @@ internal static class CssRelativePath
foreach (Match match in matches)
{
string quoteDelimiter = match.Groups[1].Value; //url('') vs url("")
string relativePathToCss = match.Groups[2].Value;
var quoteDelimiter = match.Groups[1].Value; //url('') vs url("")
var relativePathToCss = match.Groups[2].Value;
// Ignore root relative references
if (relativePathToCss.StartsWith("/", StringComparison.Ordinal))
{
continue;
}
//prevent query string from causing error
var pathAndQuery = relativePathToCss.Split(new[] { '?' }, 2, StringSplitOptions.RemoveEmptyEntries);
var pathOnly = pathAndQuery[0];
var queryOnly = pathAndQuery.Length == 2 ? pathAndQuery[1] : string.Empty;
string absolutePath = GetAbsolutePath(cssDirectoryPath, pathOnly);
string serverRelativeUrl = MakeRelative(absoluteOutputPath, absolutePath);
var absolutePath = GetAbsolutePath(cssDirectoryPath, pathOnly);
var serverRelativeUrl = MakeRelative(absoluteOutputPath, absolutePath);
if (!string.IsNullOrEmpty(queryOnly))
{
serverRelativeUrl += "?" + queryOnly;
}
string replace = string.Format("url({0}{1}{0})", quoteDelimiter, serverRelativeUrl);
var replace = string.Format("url({0}{1}{0})", quoteDelimiter, serverRelativeUrl);
cssFileContents = cssFileContents.Replace(match.Groups[0].Value, replace);
}
@ -55,22 +59,18 @@ internal static class CssRelativePath
return Path.GetFullPath(Path.Combine(cssFilePath, pathOnly));
}
private static readonly string _protocol = "file:///";
private const string Protocol = "file:///";
private static string MakeRelative(string baseFile, string file)
{
if (string.IsNullOrEmpty(file))
{
return file;
}
Uri baseUri = new Uri(_protocol + baseFile, UriKind.RelativeOrAbsolute);
Uri fileUri = new Uri(_protocol + file, UriKind.RelativeOrAbsolute);
var baseUri = new Uri(Protocol + baseFile, UriKind.RelativeOrAbsolute);
var fileUri = new Uri(Protocol + file, UriKind.RelativeOrAbsolute);
if (baseUri.IsAbsoluteUri)
{
return Uri.UnescapeDataString(baseUri.MakeRelativeUri(fileUri).ToString());
}
else
{
return baseUri.ToString();
}
return baseUri.IsAbsoluteUri ? Uri.UnescapeDataString(baseUri.MakeRelativeUri(fileUri).ToString()) : baseUri.ToString();
}
}

7
modules/basic-theme/Volo.Abp.BasicTheme.sln

@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BasicTheme.Installer", "src\Volo.Abp.BasicTheme.Installer\Volo.Abp.BasicTheme.Installer.csproj", "{3068A87F-3348-4981-8241-2630BC496117}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling", "src\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling.csproj", "{D02053D9-10EF-4717-A792-A53F83347816}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -58,6 +60,10 @@ Global
{3068A87F-3348-4981-8241-2630BC496117}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3068A87F-3348-4981-8241-2630BC496117}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3068A87F-3348-4981-8241-2630BC496117}.Release|Any CPU.Build.0 = Release|Any CPU
{D02053D9-10EF-4717-A792-A53F83347816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D02053D9-10EF-4717-A792-A53F83347816}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D02053D9-10EF-4717-A792-A53F83347816}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D02053D9-10EF-4717-A792-A53F83347816}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C8068E7F-4A04-4755-8976-C2A4C0ADC708} = {ED6D078F-B0A2-48E8-A09D-3B7CDF6CE3D1}
@ -68,5 +74,6 @@ Global
{51B491ED-F959-4974-A876-528B5F16BC92} = {0BC55E3B-4964-48E3-A390-2ADD37980149}
{8C336CB8-F7A9-4203-AE55-D8F5FDB2A958} = {0BC55E3B-4964-48E3-A390-2ADD37980149}
{3068A87F-3348-4981-8241-2630BC496117} = {ED6D078F-B0A2-48E8-A09D-3B7CDF6CE3D1}
{D02053D9-10EF-4717-A792-A53F83347816} = {ED6D078F-B0A2-48E8-A09D-3B7CDF6CE3D1}
EndGlobalSection
EndGlobal

20
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule.cs

@ -0,0 +1,20 @@
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling;
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyThemingBundlingModule)
)]
public class AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
var globalStyles = options.StyleBundles.Get(BlazorWebAssemblyStandardBundles.Styles.Global);
globalStyles.AddContributors(typeof(BasicThemeBundleStyleContributor));
});
}
}

12
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/BasicThemeBundleStyleContributor.cs

@ -0,0 +1,12 @@
using System.Collections.Generic;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling;
public class BasicThemeBundleStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web.BasicTheme/libs/abp/css/theme.css");
}
}

3
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

15
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling.csproj

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\..\configureawait.props" />
<Import Project="..\..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<PackageId>Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling.csproj" />
</ItemGroup>
</Project>

2
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/AbpAspNetCoreComponentsWebAssemblyBasicThemeModule.cs

@ -3,6 +3,7 @@ using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.BasicTheme;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Components.Web.Theming.Toolbars;
using Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming;
using Volo.Abp.Http.Client.IdentityModel.WebAssembly;
using Volo.Abp.Modularity;
@ -10,6 +11,7 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme;
[DependsOn(
typeof(AbpAspNetCoreComponentsWebAssemblyBasicThemeBundlingModule),
typeof(AbpAspNetCoreComponentsWebBasicThemeModule),
typeof(AbpAspNetCoreComponentsWebAssemblyThemingModule),
typeof(AbpHttpClientIdentityModelWebAssemblyModule)

4
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/BasicThemeBundleContributor.cs

@ -1,7 +1,9 @@
using Volo.Abp.Bundling;
using System;
using Volo.Abp.Bundling;
namespace Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme;
[Obsolete("This class is obsolete and will be removed in the future versions. Use GlobalAssets instead.")]
public class BasicThemeBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)

1
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.csproj

@ -12,6 +12,7 @@
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.Web.BasicTheme\Volo.Abp.AspNetCore.Components.Web.BasicTheme.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.WebAssembly\Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling.csproj" />
</ItemGroup>
</Project>

5
nupkg/common.ps1

@ -108,9 +108,11 @@ $projects = (
"framework/src/Volo.Abp.AspNetCore.Components.Web.Theming",
"framework/src/Volo.Abp.AspNetCore.Components.WebAssembly",
"framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming",
"framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling",
"framework/src/Volo.Abp.AspNetCore.Components.Server",
"framework/src/Volo.Abp.AspNetCore.Components.Server.Theming",
"framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming",
"framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming",
"framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.Bundling",
"framework/src/Volo.Abp.AspNetCore.MultiTenancy",
"framework/src/Volo.Abp.AspNetCore.Mvc.Client",
"framework/src/Volo.Abp.AspNetCore.Mvc.Client.Common",
@ -282,6 +284,7 @@ $projects = (
"modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme",
"modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme",
"modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme",
"modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling",
"modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic",
"modules/basic-theme/src/Volo.Abp.BasicTheme.Installer",
"source-code/Volo.Abp.BasicTheme.SourceCode",

4
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyCompanyName.MyProjectName.Blazor.Server.Mongo.csproj

@ -22,8 +22,8 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

4
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj

@ -22,8 +22,8 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/MyCompanyName.MyProjectName.Blazor.WebAssembly.Client.csproj

@ -21,7 +21,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.WebAssembly\Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

13
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/MyProjectNameBundleContributor.cs

@ -1,19 +1,14 @@
using Volo.Abp.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace MyCompanyName.MyProjectName;
/* Add your global styles/scripts here.
* See https://docs.abp.io/en/abp/latest/UI/Blazor/Global-Scripts-Styles to learn how to use it
*/
public class MyProjectNameBundleContributor : IBundleContributor
public class MyProjectNameBundleContributor : BundleContributor
{
public void AddScripts(BundleContext context)
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
context.Files.Add(new BundleFile("main.css", true));
}
}

10
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/appsettings.json

@ -11,15 +11,5 @@
"Default": {
"BaseUrl": "https://localhost:44300"
}
},
"AbpCli": {
"Bundle": {
"Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
"Name": "global",
"IsBlazorWebApp": true,
"Parameters": {
}
}
}
}

30
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.css

File diff suppressed because one or more lines are too long

37
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

9
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/Components/App.razor

@ -8,10 +8,8 @@
<title>MyCompanyName.MyProjectName.Blazor</title>
<base href="/" />
<!--ABP:Styles-->
<link href="global.css?_v=638473198173942238" rel="stylesheet"/>
<link href="global.css" rel="stylesheet"/>
<link href="main.css" rel="stylesheet"/>
<!--/ABP:Styles-->
<link href="MyCompanyName.MyProjectName.Blazor.styles.css" rel="stylesheet"/>
<!-- <TEMPLATE-REMOVE IF-NOT='PWA'> -->
@ -36,9 +34,6 @@
<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"/>
</div>
<!--ABP:Scripts-->
<script src="global.js?_v=638473198175165417"></script>
<!--/ABP:Scripts-->
<script src="global.js"></script>
</body>
</html>

3
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyCompanyName.MyProjectName.Blazor.WebAssembly.Server.Mongo.csproj

@ -74,7 +74,8 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

4
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs

@ -5,13 +5,13 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName;
using MyCompanyName.MyProjectName.Components;
using MyCompanyName.MyProjectName.MultiTenancy;
using OpenIddict.Validation.AspNetCore;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
@ -60,6 +60,7 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
@ -310,7 +311,6 @@ public class MyProjectNameHostModule : AbpModule
}
app.UseCorrelationId();
app.UseBlazorFrameworkFiles();
app.MapAbpStaticAssets();
app.UseRouting();
app.UseCors();

9
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/Components/App.razor

@ -8,10 +8,8 @@
<title>MyCompanyName.MyProjectName.Blazor</title>
<base href="/" />
<!--ABP:Styles-->
<link href="global.css?_v=638424860497814240" rel="stylesheet"/>
<link href="global.css" rel="stylesheet"/>
<link href="main.css" rel="stylesheet"/>
<!--/ABP:Styles-->
<link href="MyCompanyName.MyProjectName.Blazor.styles.css" rel="stylesheet"/>
<!-- <TEMPLATE-REMOVE IF-NOT='PWA'> -->
@ -36,9 +34,6 @@
<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"/>
</div>
<!--ABP:Scripts-->
<script src="global.js?_v=638424860499290294"></script>
<!--/ABP:Scripts-->
<script src="global.js"></script>
</body>
</html>

3
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyCompanyName.MyProjectName.Blazor.WebAssembly.Server.csproj

@ -75,7 +75,8 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

6
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs

@ -5,13 +5,13 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using MyCompanyName.MyProjectName.Data;
using MyCompanyName.MyProjectName.Localization;
using MyCompanyName.MyProjectName;
using MyCompanyName.MyProjectName.Components;
using MyCompanyName.MyProjectName.MultiTenancy;
using OpenIddict.Validation.AspNetCore;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc;
@ -63,6 +63,7 @@ namespace MyCompanyName.MyProjectName;
typeof(AbpAutoMapperModule),
typeof(AbpEntityFrameworkCoreSqlServerModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
@ -138,7 +139,7 @@ public class MyProjectNameHostModule : AbpModule
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "00000000-0000-0000-0000-000000000000");
});
}
MyProjectNameEfCoreEntityExtensionMappings.Configure();
}
@ -329,7 +330,6 @@ public class MyProjectNameHostModule : AbpModule
}
app.UseCorrelationId();
app.UseBlazorFrameworkFiles();
app.MapAbpStaticAssets();
app.UseRouting();
app.UseCors();

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyCompanyName.MyProjectName.Host.Mongo.csproj

@ -70,7 +70,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyCompanyName.MyProjectName.Host.csproj

@ -71,7 +71,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyCompanyName.MyProjectName.Mvc.Mongo.csproj

@ -18,7 +18,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyCompanyName.MyProjectName.Mvc.csproj

@ -18,7 +18,7 @@
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj

@ -51,7 +51,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyCompanyName.MyProjectName.Blazor.Client.csproj

@ -24,7 +24,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.WebAssembly\Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

1
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyProjectNameBlazorClientModule.cs

@ -2,7 +2,6 @@
using System.Net.Http;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

13
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/MyProjectNameBundleContributor.cs

@ -1,19 +1,14 @@
using Volo.Abp.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace MyCompanyName.MyProjectName.Blazor.Client;
/* Add your global styles/scripts here.
* See https://abp.io/docs/latest/framework/ui/blazor/global-scripts-styles to learn how to use it
*/
public class MyProjectNameBundleContributor : IBundleContributor
public class MyProjectNameBundleContributor : BundleContributor
{
public void AddScripts(BundleContext context)
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
context.Files.Add(new BundleFile("main.css", true));
}
}

10
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/appsettings.json

@ -8,15 +8,5 @@
"Default": {
"BaseUrl": "https://localhost:44305"
}
},
"AbpCli": {
"Bundle": {
"Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
"Name": "global",
"IsBlazorWebApp": true,
"Parameters": {
}
}
}
}

30
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.css

File diff suppressed because one or more lines are too long

37
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

4
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj

@ -30,8 +30,8 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

4
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyCompanyName.MyProjectName.Blazor.Server.csproj

@ -29,8 +29,8 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/MyCompanyName.MyProjectName.Blazor.WebApp.Client.csproj

@ -25,7 +25,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.WebAssembly\Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

13
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/MyProjectNameBundleContributor.cs

@ -1,19 +1,14 @@
using Volo.Abp.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace MyCompanyName.MyProjectName.Blazor.WebApp.Client;
/* Add your global styles/scripts here.
* See https://docs.abp.io/en/abp/latest/UI/Blazor/Global-Scripts-Styles to learn how to use it
*/
public class MyProjectNameBundleContributor : IBundleContributor
public class MyProjectNameBundleContributor : BundleContributor
{
public void AddScripts(BundleContext context)
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
context.Files.Add(new BundleFile("main.css", true));
}
}

11
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/appsettings.json

@ -3,16 +3,5 @@
"Default": {
"BaseUrl": "https://localhost:44308"
}
},
"AbpCli": {
"Bundle": {
"Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
"Name": "global",
"IsBlazorWebApp": true,
"InteractiveAuto": true,
"Parameters": {
}
}
}
}

17
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.css

File diff suppressed because one or more lines are too long

37
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client.csproj

@ -25,7 +25,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Http.Client.IdentityModel.WebAssembly\Volo.Abp.Http.Client.IdentityModel.WebAssembly.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

13
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/MyProjectNameBundleContributor.cs

@ -1,19 +1,14 @@
using Volo.Abp.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client;
/* Add your global styles/scripts here.
* See https://docs.abp.io/en/abp/latest/UI/Blazor/Global-Scripts-Styles to learn how to use it
*/
public class MyProjectNameBundleContributor : IBundleContributor
public class MyProjectNameBundleContributor : BundleContributor
{
public void AddScripts(BundleContext context)
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
context.Files.Add(new BundleFile("main.css", true));
}
}

11
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/appsettings.json

@ -6,16 +6,5 @@
},
"AuthServer": {
"Authority": "https://localhost:44301"
},
"AbpCli": {
"Bundle": {
"Mode": "BundleAndMinify", /* Options: None, Bundle, BundleAndMinify */
"Name": "global",
"IsBlazorWebApp": true,
"InteractiveAuto": true,
"Parameters": {
}
}
}
}

17
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.css

File diff suppressed because one or more lines are too long

37
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

4
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.csproj

@ -32,8 +32,8 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs

@ -28,6 +28,7 @@ using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme;
using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
@ -67,6 +68,7 @@ namespace MyCompanyName.MyProjectName.Blazor.WebApp.Tiered;
typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpAspNetCoreComponentsServerLeptonXLiteThemeModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
@ -140,6 +142,9 @@ public class MyProjectNameBlazorModule : AbpModule
{
Configure<AbpBundlingOptions>(options =>
{
// Blazor Web App
options.Parameters.InteractiveAuto = true;
// MVC UI
options.StyleBundles.Configure(
LeptonXLiteThemeBundles.Styles.Global,

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyCompanyName.MyProjectName.Blazor.WebApp.csproj

@ -30,8 +30,9 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming\Volo.Abp.AspNetCore.Components.Server.Theming.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Web.Theming\Volo.Abp.AspNetCore.Components.Web.Theming.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs

@ -23,6 +23,7 @@ using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme;
using Volo.Abp.AspNetCore.Components.Server.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
@ -57,6 +58,7 @@ namespace MyCompanyName.MyProjectName.Blazor.WebApp;
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebOpenIddictModule),
typeof(AbpAspNetCoreComponentsServerLeptonXLiteThemeModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpIdentityBlazorServerModule),
typeof(AbpTenantManagementBlazorServerModule),
@ -154,6 +156,9 @@ public class MyProjectNameBlazorModule : AbpModule
{
Configure<AbpBundlingOptions>(options =>
{
// Blazor Web App
options.Parameters.InteractiveAuto = true;
// MVC UI
options.StyleBundles.Configure(
LeptonXLiteThemeBundles.Styles.Global,

8
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/App.razor

@ -7,10 +7,8 @@
<title>MyCompanyName.MyProjectName.Blazor</title>
<base href="/" />
<!--ABP:Styles-->
<link href="global.css?_v=638521426525844522" rel="stylesheet"/>
<link href="global.css" rel="stylesheet"/>
<link href="main.css" rel="stylesheet"/>
<!--/ABP:Styles-->
<link href="MyCompanyName.MyProjectName.Blazor.Client.styles.css" rel="stylesheet"/>
<!-- <TEMPLATE-REMOVE IF-NOT='PWA'> -->
@ -35,9 +33,7 @@
<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"/>
</div>
<!--ABP:Scripts-->
<script src="global.js?_v=638521426528310132"></script>
<!--/ABP:Scripts-->
<script src="global.js"></script>
<!-- <TEMPLATE-REMOVE IF-NOT='PWA'> -->
<script>

8
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyCompanyName.MyProjectName.Blazor.csproj

@ -7,8 +7,16 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0.0" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bundling\Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling" Version="4.1.0-preview*" />
<ProjectReference Include="..\MyCompanyName.MyProjectName.Blazor.Client\MyCompanyName.MyProjectName.Blazor.Client.csproj" />
</ItemGroup>

63
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs

@ -0,0 +1,63 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MyCompanyName.MyProjectName.Blazor.Client;
using Volo.Abp;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
namespace MyCompanyName.MyProjectName.Blazor;
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMvcUiBundlingModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXLiteThemeBundlingModule)
)]
public class MyProjectNameBlazorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//https://github.com/dotnet/aspnetcore/issues/52530
Configure<RouteOptions>(options =>
{
options.SuppressCheckForUnhandledSecurityMetadata = true;
});
// Add services to the container.
context.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
// Configure the HTTP request pipeline.
if (env.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.MapAbpStaticAssets();
app.UseRouting();
app.UseAntiforgery();
app.UseConfiguredEndpoints(builder =>
{
builder.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(WebAppAdditionalAssembliesHelper.GetAssemblies<MyProjectNameBlazorClientModule>());
});
}
}

86
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs

@ -1,43 +1,57 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MyCompanyName.MyProjectName.Blazor;
using MyCompanyName.MyProjectName.Blazor.Client;
using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp;
using Serilog;
using Serilog.Events;
var builder = WebApplication.CreateBuilder(args);
namespace MyCompanyName.MyProjectName.Blazor;
//https://github.com/dotnet/aspnetcore/issues/52530
builder.Services.Configure<RouteOptions>(options =>
public class Program
{
options.SuppressCheckForUnhandledSecurityMetadata = true;
});
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.MapStaticAssets();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(WebAppAdditionalAssembliesHelper.GetAssemblies<MyProjectNameBlazorClientModule>());
await app.RunAsync();
public async static Task<int> Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.Console())
.CreateLogger();
try
{
Log.Information("Starting web host.");
var builder = WebApplication.CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
await builder.AddApplicationAsync<MyProjectNameBlazorModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
{
if (ex is HostAbortedException)
{
throw;
}
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
}

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj

@ -26,7 +26,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj

@ -28,7 +28,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj

@ -49,7 +49,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" />
<!-- </TEMPLATE-REMOVE> -->
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.2.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="4.1.0-preview*" />
</ItemGroup>
<ItemGroup>

7
templates/module/aspnet-core/MyCompanyName.MyProjectName.sln

@ -63,6 +63,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName.Blazor.Host", "host\MyCompanyName.MyProjectName.Blazor.Host\MyCompanyName.MyProjectName.Blazor.Host.csproj", "{C33FD057-839D-4F92-BA81-DD40B03FB75D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCompanyName.MyProjectName.Blazor.WebAssembly.Bundling", "src\MyCompanyName.MyProjectName.Blazor.WebAssembly.Bundling\MyCompanyName.MyProjectName.Blazor.WebAssembly.Bundling.csproj", "{43E17629-2AA1-4B82-B70B-DB4B500BE19A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -177,6 +179,10 @@ Global
{C33FD057-839D-4F92-BA81-DD40B03FB75D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C33FD057-839D-4F92-BA81-DD40B03FB75D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C33FD057-839D-4F92-BA81-DD40B03FB75D}.Release|Any CPU.Build.0 = Release|Any CPU
{43E17629-2AA1-4B82-B70B-DB4B500BE19A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43E17629-2AA1-4B82-B70B-DB4B500BE19A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43E17629-2AA1-4B82-B70B-DB4B500BE19A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43E17629-2AA1-4B82-B70B-DB4B500BE19A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -209,6 +215,7 @@ Global
{FEA752A1-5B4E-49E9-B1F3-DDC25E41BB52} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{BE39FD00-745B-4049-8161-FC129817CBE4} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
{C33FD057-839D-4F92-BA81-DD40B03FB75D} = {E400416D-2895-4512-9D17-90681EEC7E0A}
{43E17629-2AA1-4B82-B70B-DB4B500BE19A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}

16
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/MyProjectNameBlazorHostBundleContributor.cs

@ -1,16 +1,14 @@
using Volo.Abp.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
namespace MyCompanyName.MyProjectName.Blazor.Host.Client;
public class MyProjectNameBlazorHostBundleContributor : IBundleContributor
/* Add your global styles/scripts here.
* See https://docs.abp.io/en/abp/latest/UI/Blazor/Global-Scripts-Styles to learn how to use it
*/
public class MyProjectNameBlazorHostBundleContributor : BundleContributor
{
public void AddScripts(BundleContext context)
public override void ConfigureBundle(BundleConfigurationContext context)
{
}
public void AddStyles(BundleContext context)
{
context.Add("main.css", true);
context.Files.Add(new BundleFile("main.css", true));
}
}

22
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.css

File diff suppressed because one or more lines are too long

9
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host.Client/wwwroot/global.js

File diff suppressed because one or more lines are too long

10
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/App.razor

@ -7,10 +7,9 @@
<title>MyCompanyName.MyProjectName.Blazor</title>
<base href="/" />
<!--ABP:Styles-->
<link href="global.css?_v=638521427097657777" rel="stylesheet"/>
<link href="global.css" rel="stylesheet"/>
<link href="main.css" rel="stylesheet"/>
<!--/ABP:Styles-->
<link href="MyCompanyName.MyProjectName.Blazor.Host.Client.styles.css" rel="stylesheet"/>
<HeadOutlet @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)" />
@ -29,9 +28,6 @@
<Routes @rendermode="new InteractiveWebAssemblyRenderMode(prerender: false)"/>
</div>
<!--ABP:Scripts-->
<script src="global.js?_v=638521427098258852"></script>
<!--/ABP:Scripts-->
<script src="global.js"></script>
</body>
</html>

8
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/MyCompanyName.MyProjectName.Blazor.Host.csproj

@ -7,8 +7,16 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0.0" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.AspNetCore.Mvc.UI.Bundling\Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling\Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme.Bundling.csproj" />
<ProjectReference Include="..\MyCompanyName.MyProjectName.Blazor.Host.Client\MyCompanyName.MyProjectName.Blazor.Host.Client.csproj" />
</ItemGroup>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save