Blazor-MAUI-WebAPI etc

Forums


Content related to Blazor, "Blazor Hybrid", MAUI and WebAPI etc..
 

Comments

Permalink

New .Net-project "maui-blazor-web" (".NET MAUI Blazor Hybrid and Web App")
https://www.youtube.com/watch?v=ilUohNPqnkU


Show .Net SDKs and Runtimes installed: "dotnet --list-sdks" / "dotnet --list-runtimes"
If .Net 9 is missing, try: "winget install --id Microsoft.DotNet.SDK.9 -e"

"dotnet workload list" - Check to see that Workload Id "maui" exist..

If it does not exist run:
1. "dotnet workload update"
2. "dotnet workload install maui"

Command to check if new .Net template for Blazor Hybrid exists: "dotnet new list" (look in list for "maui-blazor-web")
Using the new .Net template for Blazor Hybrid-project from command-line: "dotnet new maui-blazor-web -n ProjectName"
(easier to use Visual Studio and search for template ".NET MAUI Blazor Hybrid and Web App")

When hosting a "Blazor Standalone Webassembly" application it is likely that CORS need to be enabled/allowed on the hosting site.
The curl-command below is an example how the status of CORS can be checked for the hosting site:

curl -I -H "Origin: https://your-blazor-app.com:port" https://your-drupal-site.com/api

Check the response so that rows beginning with "Access-Control-Allow-" are shown.
 (otherwize CORS is not active or allowed for your Blazor application.) 

Resources and notes for Blazor-projects:

DescriptionURL
Microsoft learning path "Build web apps with Blazor":https://learn.microsoft.com/en-us/training/paths/build-web-apps-with-blazor/
Video "Learn Blazor Hybrid - Full Course" (Gerald Versluis, 251min)
 (in solution "part 6" the element "<FluentMenuProvider />" needs to be added to the file "MainLayout.razor")
https://www.youtube.com/watch?v=Ou0k5XKcIh4
Video "Blazor Hybrid (+.NET MAUI) Tutorial for Beginners" (James Montemagno, 45min)https://www.youtube.com/watch?v=lqLfY9zNKNY
Video "Intro to Blazor Hybrid (.NET MAUI Blazor)" (IAmTimCorey, 37 min)https://www.youtube.com/watch?v=v36s9snCrXU

Fluent UI Blazor library
NOTE: The root namespace of FluentUI has been changed from Microsoft.Fast.Components.FluentUI to Microsoft.FluentUI.AspNetCore.Components for latest versions:
https://baaijte.net/blog/microsoft-fluentui-aspnetcore.components-4/

To install VS-templates for Fluent UI, run the command
"dotnet new install Microsoft.FluentUI.AspNetCore.Templates"

It should result in 4 new Visual Studio templates:
"Fluent .NET Aspire Starter App" (short-name: fluentaspire-starter)
"Fluent .NET MAUI Blazor Hybrid and Web App" (short-name: fluentmaui-blazor-web)
"Fluent Blazor Web App"  (short-name: fluentblazor)
"Fluent Blazor WebAssembly Standalone App"  (short-name: fluentblazorwasm)

https://www.fluentui-blazor.net/
AlohaKit.Controls for MAUIhttps://github.com/jsuarezruiz/AlohaKit.Controls
.NET MAUI Community Toolkit
 (useful for styling the "Android status bar"..)
https://github.com/CommunityToolkit/Maui
Article ".NET MAUI Blazor - Best practices for mobile UI"https://dev.to/mhrastegari/net-maui-blazor-best-practices-for-mobile-ui-4def
Host and deploy ASP.NET Core Blazor WebAssembly
 (also with description for "GitHub Pages")
https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-9.0
Visual Studio Extension "Blazm.Extension"https://github.com/EngstromJimmy/Blazm.Extension
 (described here: https://www.youtube.com/watch?v=vgCmkL4l0h8)
 
Install "wasm tools" (needed for sqlite in Blazor WebAssembly projects)dotnet workload install wasm-tools-net8 --skip-sign-check --include-previews --download-to-cache "C:\offline-cache"

(adjust parameters before use, the example downloads the ".Net 8-version" to a cache-folder, which might not be of interest..)

 

This is some placeholder content for a vertical collapse. It's hidden by default and shown when triggered.


 

If Visual Studio shows an error, "The project needs to be deployed before we can debug"

"The project needs to be deployed before we can debug. 
Please enable Deploy in the Configuration Manager." (DEP1000)

Check path in error message, if it is longer than 264 characters try to shorten the folder-names in the repository.
Or check this article: https://crodrigues.com/maui-blazor-hybrid-fixing-the-this-project-needs-to-be-deployed-before-we-can-debug-error/
 
If Visual Studio shows an error that Android Emulator cannot be started, check this article on Hyper-V and AEHD:
 (when using AEHD make sure Hyper-V is turned off.)
https://learn.microsoft.com/en-us/dotnet/maui/android/emulator/hardware-acceleration?view=net-maui-9.0
 (download https://github.com/google/android-emulator-hypervisor-driver/releases and run "silent_install.bat" (verify installation using "sc query aehd")
 

-