-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Blazor Desktop
- Install required .NET MAUI dependencies described in the .NET MAUI Development Guide.
- Follow the other instructions on that guide for how to build, open the solution, etc.
- On VS Windows use the
Microsoft.Maui-net6.sln
solution, and on VS Mac use theMicrosoft.Maui-mac.slnf
solution filter
The area/blazor 🕸️
label is used to track Blazor items: https://github.com/dotnet/maui/issues?q=is%3Aissue+is%3Aopen+label%3A%22area%2Fblazor+%F0%9F%95%B8%EF%B8%8F%22
This private project is used for triaging/prioritization: https://github.com/orgs/dotnet/projects/81/views/1
The Blazor-related projects in the repo are mostly located in the src/BlazorWebView folder, aside from the MAUI sample app:
WinForms | WPF | .NET MAUI |
---|---|---|
source | source | source |
- | - | templates |
sample | sample | sample code, and sample app |
- | - | tests |
The main component on each platform is the BlazorWebView
control. They each have a unique implementation in the source locations above, though they do use some shared source for Windows/WebView2 related code.
The core WebView integration with Blazor is handled within the dotnet/aspnetcore
repo here.
Sometimes it may be necessary to make changes in dotnet/aspnetcore
, and react to the changes in this repo. The following are steps which outline the general process in using ASP.NET Core development nupkg
s with MAUI.
-
Checkout
dotnet/aspnetcore
, and follow the initialization instructions in the Build From Source guide. -
./restore.cmd
-
. ./activate.ps1
-
Make the desired changes in
dotnet/aspnetcore
. -
./eng/build.cmd -pack
. The-pack
option causes the creation of NuGet packages.- Note packing the full repo is only required upon the first change. Subsequent changes are likely to be isolated in
src/Components
, hence you should be able too use.\src\Components\build.cmd -pack
.
- Note packing the full repo is only required upon the first change. Subsequent changes are likely to be isolated in
-
You should see the generated packages in the
aspnetcore\artifacts\packages\Debug\NonShipping
directory. The packages should end withx.0.0-dev.nupkg
wherex
is the current (pre-release) .NET version ORy.0.patch.nupkg
wherey
is the current (released) .NET version andpatch
is the current patch version (ex.6.0.4.nupkg
). We'll refer to the version seen here asVERSION
in subsequent steps. -
Open
razor-tooling/NuGet.config
and add the local package sources:dotnet nuget add source "<PATH_TO_ASPNET_CORE_REPO>\artifacts\packages\Debug\Shipping\" --name "ASPNETCORE_SHIPPING"
dotnet nuget add source "<PATH_TO_ASPNET_CORE_REPO>\artifacts\packages\Debug\NonShipping\" --name "ASPNETCORE_NONSHIPPING"
-
Open
maui/eng/Versions.props
and update all theMicrosoftAspNetCore*PackageVersion
andMicrosoftJSInteropPackageVersion
to reflect theVERSION
. -
Go to
<USER_HOME>\.nuget\packages\microsoft.aspnetcore.components.webview
and delete the directory namedVERSION
. This clears the nuget cache. -
Run
dotnet restore
in the directory for the app you're trying the experimental aspnetcore changes in (ex.\src\BlazorWebView\samples\BlazorWpfApp
). -
You can now run the application and it'll use the experimental aspnetcore changes. Note, subsequent changes in the
aspnetcore
repo will require rebuilding (.\src\Components\build.cmd -pack
) and repeating the previous two steps (clear nuget cache, rundotnet restore
).
Go to this channel (and request to join if you don't have access).
Watch the recording of a brownbag session on working on Blazor Hybrid (Microsoft internal)