WPF Blazorシンプルアプリを作成するためのテンプレート
https://github.com/kznagamori/WpfBlazorSimpleAppTemplate.git
をダウンロードして、任意のディレクトリに展開します。
dotnet new install .\WpfBlazorSimpleAppTemplate
dotnet new wpf-blazor-simple -n <プロジェクト名>
例: dotnet new wpf-blazor-simple -n MyWpfBlazor
csprjファイルのTargetFrameworkの設定をビルドを行うdotnet sdkのバージョンに合わせます。
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
net8.0-windows
もしくは、net7.0-windows
が設定可能です。
プロジェクトディレクトリ内で以下のコマンドを入力して、パッケージのインストールを行います。
dotnet add package Microsoft.AspNetCore.Components.WebView.Wpf
dotnet add package Microsoft.AspNetCore.Components.WebView.Wpf --version 7.0.101
dotnet build
dotnet publish -c Release