Lewati ke konten
DokumentasiCoba Aspire
DokumentasiCoba

Compiler Warning ASPIREDOTNETTOOL001

Konten ini belum tersedia dalam bahasa Anda.

Version introduced: 13.2

.NET tool resource 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 .NET tool resource APIs in Aspire, including:

  • DotnetToolResource
  • DotnetToolAnnotation
  • AddDotnetTool extension methods

The following code generates ASPIREDOTNETTOOL (documented here as ASPIREDOTNETTOOL001):

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var tool = builder.AddDotnetTool("my-tool", "dotnet-tool-package");
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.ASPIREDOTNETTOOL.severity = none
    dotnet_diagnostic.ASPIREDOTNETTOOL001.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);ASPIREDOTNETTOOL;ASPIREDOTNETTOOL001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable directive:

    Suppressing the warning
    #pragma warning disable ASPIREDOTNETTOOL, ASPIREDOTNETTOOL001
    var tool = builder.AddDotnetTool("my-tool", "dotnet-tool-package");
    #pragma warning restore ASPIREDOTNETTOOL, ASPIREDOTNETTOOL001