Use this guide for an ABP blazor WebAssembly application. The matching working sample is samples/WebAppBlazorWebAssembly.
abp new BookStore -u blazor -t appThe paths below use the generated BookStore solution layout.
Add these references to src/BookStore.Blazor.Client/BookStore.Blazor.Client.csproj:
Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignThemeLsw.Abp.IdentityManagement.Blazor.WebAssembly.AntDesignUILsw.Abp.TenantManagement.Blazor.WebAssembly.AntDesignUILsw.Abp.SettingManagement.Blazor.WebAssembly.AntDesignUILsw.Abp.FeatureManagement.Blazor.WebAssembly.AntDesignUILsw.Abp.AntDesignThemeManagement.Blazor.WebAssembly
Add this reference to src/BookStore.HttpApi.Host/BookStore.HttpApi.Host.csproj:
Lsw.Abp.AntDesignThemeManagement.Application
Add this reference to src/BookStore.Blazor/BookStore.Blazor.csproj:
Lsw.Abp.AspnetCore.Components.WebAssembly.AntDesignTheme.Bundling
Use ProjectReference inside this repository, or the same package names when consuming NuGet packages.
Remove the old Blazorise-based Blazor packages from the same projects if they exist:
Blazorise.Bootstrap5Blazorise.Icons.FontAwesomeBlazorise.ComponentsVolo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteThemeVolo.Abp.AspNetCore.Components.WebAssembly.LeptonXLiteTheme.BundlingVolo.Abp.Identity.Blazor.WebAssemblyVolo.Abp.TenantManagement.Blazor.WebAssemblyVolo.Abp.SettingManagement.Blazor.WebAssemblyVolo.Abp.FeatureManagement.Blazor.WebAssembly
Do not remove Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite from the HTTP API host unless you also replace the MVC/account-page theme.
Open src/BookStore.Blazor.Client/BookStoreBlazorClientModule.cs.
In the existing [DependsOn], use these AntDesign entries:
typeof(AbpIdentityBlazorWebAssemblyAntDesignModule),
typeof(AbpSettingManagementBlazorWebAssemblyAntDesignModule),
typeof(AbpFeatureManagementBlazorWebAssemblyAntDesignModule),
typeof(AbpTenantManagementBlazorWebAssemblyAntDesignModule),
typeof(AbpAspNetCoreComponentsWebAssemblyAntDesignThemeModule),
typeof(AbpAntDesignThemeManagementBlazorWebAssemblyModule)Configure the client router:
private void ConfigureRouter(ServiceConfigurationContext context)
{
Configure<AbpRouterOptions>(options =>
{
options.AppAssembly = typeof(BookStoreBlazorClientModule).Assembly;
});
}Remove the old Blazorise provider setup if it exists.
Open src/BookStore.HttpApi.Host/BookStoreHttpApiHostModule.cs.
Add the theme management application module to [DependsOn]:
typeof(AbpAntDesignThemeManagementApplicationModule)Expose the theme management application service:
private void ConfigureConventionalControllers()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
options.ConventionalControllers.Create(typeof(AbpAntDesignThemeManagementApplicationModule).Assembly);
});
}Open src/BookStore.Blazor/BookStoreBlazorModule.cs.
Add the WebAssembly AntDesign bundling module to [DependsOn]:
typeof(AbpAspNetCoreComponentsWebAssemblyAntDesignThemeBundlingModule)Add these imports to src/BookStore.Blazor.Client/_Imports.razor:
@using AntDesign
@using Lsw.Abp.AntDesignUI
@using Lsw.Abp.AntDesignUI.Components
@using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Layout
@using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.BundlingUse the AntDesign layout in src/BookStore.Blazor.Client/Routes.razor:
@using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Routing
@using Lsw.Abp.AspnetCore.Components.Web.AntDesignTheme.Themes.AntDesignTheme
@using Volo.Abp.AspNetCore.Components.WebAssembly.WebApp
<Router AppAssembly="typeof(Program).Assembly" AdditionalAssemblies="WebAppAdditionalAssembliesHelper.GetAssemblies<BookStoreBlazorClientModule>()">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(DefaultLayout)">
<NotAuthorized>
<RedirectToLogin />
</NotAuthorized>
</AuthorizeRouteView>
</Found>
</Router>From the solution root:
dotnet buildTo run this repository sample, start all three projects:
cd samples/WebAppBlazorWebAssembly
dotnet run --project .\src\BookStore.DbMigrator\
dotnet run --project .\src\BookStore.HttpApi.Host\
dotnet run --project .\src\BookStore.Blazor\Open https://localhost:44376.
Log in with admin / 1q2w3E*, then verify that the AntDesign layout and right-side theme settings panel are visible.
