First Steps with Blazor Hybrid
This article provides additional details on how to use Telerik UI for Blazor components in Blazor Hybrid apps with .NET MAUI. The WebView feature of .NET allows you to embed Blazor components in native MAUI, WPF, and WinForms apps.
Prerequisites
To successfully complete the steps in this tutorial:
- Install the latest version of .NET and Visual Studio.
- Follow the general guidance at First Steps with Telerik UI for Blazor. All prerequisites and steps there are applicable to this article too.
- Install the Telerik UI for Blazor project templates.
- Before adding the Telerik UI for Blazor components to an existing Blazor Hybrid app, ensure that the corresponding technology stack is set up and the basic Blazor Hybrid WebView runs as expected in this stack.
If you want to manually add Telerik UI for Blazor to an existing WinForms, WPF, or MAUI app, the process is similar to including the components in a native Blazor app.
Create New Blazor App
To create a new Telerik Blazor MAUI Hybrid App, use your preferred approach:
Use the .NET CLI dotnet new command:
dotnet new telerik-blazor-maui -o TelerikBlazorHybridApp1
Create a new app by using the Telerik Blazor MAUI Hybrid App project template.
Run the following Telerik CLI command to create a new Telerik Blazor Hybrid app interactively:
telerik create blazor
To manually add Telerik UI for Blazor to an existing Blazor app, follow the Workflow Details article.
Running Blazor Hybrid Apps
While running hybrid applications in debug mode, it's recommended to be aware of possible caveats during deployment and prevent them upfront.
Refer to the following articles for more information on each technology stack:
Notes
- The hybrid MAUI Blazor apps allow using browser developer tools. Learn how to enable and use them...
- The Blazor web app code cannot make calls to native APIs. This feature is yet to be exposed by the framework. At the moment, you have to write your own calls to services and native app code that you need to explicitly expose.
Known Issues
-
Running MAUI apps may require developer mode to be enabled.
-
You can't currently run the app for iOS or Mac Catalyst from a Windows development environment.
-
iOS requires ahead-of-time compilation. Attempts for just-in-time (JIT) compilation may trigger errors similar to
Attempting to JIT compile method '...' while running in aot-only modeor
Could not AOT the assembly ....Check Introducing Xamarin iOS Interpreter and Could not AOT Assembly on StackOverflow. Add the
Telerik.UI.for.Blazorassembly to anMtouchExtraArgstag for the iOS Release configuration in the project file:xml<PropertyGroup> <UseInterpreter>true</UseInterpreter> <MtouchExtraArgs>--linkskip=Telerik.UI.for.Blazor</MtouchExtraArgs> </PropertyGroup>