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:
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:
Description
URL
Microsoft learning path "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")
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)
Comments
Blazor and Blazor Hybrid (with MAUI)
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:
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:
(in solution "part 6" the element "<FluentMenuProvider />" needs to be added to the file "MainLayout.razor")
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)
(useful for styling the "Android status bar"..)
(also with description for "GitHub Pages")
(described here: https://www.youtube.com/watch?v=vgCmkL4l0h8)
(adjust parameters before use, the example downloads the ".Net 8-version" to a cache-folder, which might not be of interest..)
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")
MAUI Geolocation
MAUI - Device feature "Geolocation" (GPS coordinates):
https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/device/geolocation?view=net-maui-9.0&tabs=windows