WebviewBind.Blazor
1.1.0
dotnet add package WebviewBind.Blazor --version 1.1.0
NuGet\Install-Package WebviewBind.Blazor -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebviewBind.Blazor" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebviewBind.Blazor" Version="1.1.0" />
<PackageReference Include="WebviewBind.Blazor" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebviewBind.Blazor --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebviewBind.Blazor, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebviewBind.Blazor@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebviewBind.Blazor&version=1.1.0
#tool nuget:?package=WebviewBind.Blazor&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WebviewBind.Blazor (NuGet Package)
WebviewBind.Blazor is a Razor class library that provides a DI-friendly bridge service for invoking WebView2 host methods from Blazor.
Install
dotnet add package WebviewBind.Blazor
Register Service
using WebviewBind.Blazor;
builder.Services.AddWebviewHostBridge();
Use In Razor
@inject IWebviewHostBridge HostBridge
<button @onclick="CallHost">Call Host</button>
@code {
private async Task CallHost()
{
var greeting = await HostBridge.InvokeAsync<string>("GetGreeting", "Blazor");
}
}
API Surface
ValueTask<bool> IsAvailableAsync(CancellationToken cancellationToken = default)
ValueTask<T?> InvokeAsync<T>(string methodName, params object?[]? args)
ValueTask<T?> InvokeAsync<T>(string methodName, CancellationToken cancellationToken, params object?[]? args)
ValueTask InvokeVoidAsync(string methodName, params object?[]? args)
ValueTask InvokeVoidAsync(string methodName, CancellationToken cancellationToken, params object?[]? args)
Runtime Notes (WebView2)
For Blazor WebAssembly hosted in WebView2, do not load app entry page with file://.
Use virtual host mapping and navigate to a local HTTPS-style URL.
await WebView.EnsureCoreWebView2Async();
WebView.CoreWebView2.SetVirtualHostNameToFolderMapping(
"app.local",
appFolderPath,
CoreWebView2HostResourceAccessKind.Allow);
WebView.Source = new Uri("https://app.local/index.html");
This avoids CORS failures when the runtime fetches _framework/* and _content/* assets.
Packaged Static Asset
This package includes:
_content/WebviewBind.Blazor/webviewHostBridge.js
The DI service imports that module automatically.
Example Projects
src/Examples/BlazorTestsrc/Examples/WpfWithBlazor
Repository
- Root:
README.md - Source generator package doc:
docs/WebviewBind.Package.md
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.0 | 44 | 5/19/2026 |