Compiler Warning ASPIREBLAZOR001
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Blazor WebAssembly hosting types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
This diagnostic warning is reported when using experimental Blazor WebAssembly hosting APIs from the Aspire.Hosting.Blazor integration, including:
BlazorGatewayExtensions—AddBlazorGateway,AddBlazorWasmApp,AddBlazorWasmProject<TProject>, andWithBlazorClientAppBlazorHostedExtensions— client wiring for a hosted Blazor Web AppBlazorWasmAppResource— the resource type that represents a Blazor WebAssembly app
Example
Section titled “Example”The following code generates ASPIREBLAZOR001:
var builder = DistributedApplication.CreateBuilder(args);
var gateway = builder.AddBlazorGateway("gateway");
var store = builder.AddBlazorWasmApp("store", "../Store/Store.csproj");
gateway.WithBlazorClientApp(store);
builder.Build().Run();To correct this warning
Section titled “To correct this warning”Suppress the warning with one of the following methods:
-
Set the severity of the rule in the .editorconfig file.
.editorconfig [*.{cs,vb}]dotnet_diagnostic.ASPIREBLAZOR001.severity = noneFor more information about editor config files, see Configuration files for code analysis rules.
-
Add the following
PropertyGroupto your project file:C# project file <PropertyGroup><NoWarn>$(NoWarn);ASPIREBLAZOR001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disable ASPIREBLAZOR001directive:Suppressing the warning #pragma warning disable ASPIREBLAZOR001var gateway = builder.AddBlazorGateway("gateway");#pragma warning restore ASPIREBLAZOR001
See also
Section titled “See also”- Blazor hosting integration - Learn about hosting Blazor WebAssembly apps
- Get started with Blazor - Add a Blazor WebAssembly app to your AppHost