Compiler Warning ASPIREDOTNETTOOL001
Questi contenuti non sono ancora disponibili nella tua lingua.
.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:
DotnetToolResourceDotnetToolAnnotationAddDotnetToolextension methods
Example
Section titled “Example”The following code generates ASPIREDOTNETTOOL (documented here as ASPIREDOTNETTOOL001):
var builder = DistributedApplication.CreateBuilder(args);
var tool = builder.AddDotnetTool("my-tool", "dotnet-tool-package");
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.ASPIREDOTNETTOOL.severity = nonedotnet_diagnostic.ASPIREDOTNETTOOL001.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);ASPIREDOTNETTOOL;ASPIREDOTNETTOOL001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disabledirective:Suppressing the warning #pragma warning disable ASPIREDOTNETTOOL, ASPIREDOTNETTOOL001var tool = builder.AddDotnetTool("my-tool", "dotnet-tool-package");#pragma warning restore ASPIREDOTNETTOOL, ASPIREDOTNETTOOL001
See also
Section titled “See also”- Executables - Learn about executable resources