Aller au contenu
DocumentationEssayer Aspire
DocumentationEssayer

Compiler Warning ASPIREBLAZOR001

Ce contenu n’est pas encore disponible dans votre langue.

Version introduced: 13.4

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:

  • BlazorGatewayExtensionsAddBlazorGateway, AddBlazorWasmApp, AddBlazorWasmProject<TProject>, and WithBlazorClientApp
  • BlazorHostedExtensions — client wiring for a hosted Blazor Web App
  • BlazorWasmAppResource — the resource type that represents a Blazor WebAssembly app

The following code generates ASPIREBLAZOR001:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var gateway = builder.AddBlazorGateway("gateway");
var store = builder.AddBlazorWasmApp("store", "../Store/Store.csproj");
gateway.WithBlazorClientApp(store);
builder.Build().Run();

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 = none

    For more information about editor config files, see Configuration files for code analysis rules.

  • Add the following PropertyGroup to your project file:

    C# project file
    <PropertyGroup>
    <NoWarn>$(NoWarn);ASPIREBLAZOR001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIREBLAZOR001 directive:

    Suppressing the warning
    #pragma warning disable ASPIREBLAZOR001
    var gateway = builder.AddBlazorGateway("gateway");
    #pragma warning restore ASPIREBLAZOR001