Compiler Warning ASPIREPROCESSCOMMAND001
Ce contenu n’est pas encore disponible dans votre langue.
Process command 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 the experimental WithProcessCommand extension method and related process command APIs. These APIs enable AppHost authors to expose custom resource commands backed by local processes (binaries, shell scripts, and other executables on the AppHost machine).
The following APIs are protected by this diagnostic:
WithProcessCommandonIResourceBuilder<T>— registers a command that starts a local process when invokedProcessCommandSpec— describes the process to start, including executable path, arguments, environment variables, working directory, and stdin contentProcessCommandOptions— controls command behavior such as the maximum captured output line count, success exit codes, and how the result is displayed
Example
Section titled “Example”The following code generates ASPIREPROCESSCOMMAND001:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddRedis("cache") .WithProcessCommand( name: "dotnet-version", displayName: "Show .NET version", executablePath: "dotnet", arguments: ["--version"]);
builder.Build().Run();The diagnostic is triggered because WithProcessCommand, ProcessCommandSpec, and ProcessCommandOptions are all marked with the [Experimental("ASPIREPROCESSCOMMAND001")] attribute.
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.ASPIREPROCESSCOMMAND001.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);ASPIREPROCESSCOMMAND001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disable ASPIREPROCESSCOMMAND001directive:C# — Suppressing the warning #pragma warning disable ASPIREPROCESSCOMMAND001builder.AddRedis("cache").WithProcessCommand("dotnet-version", "Show .NET version", "dotnet", ["--version"]);#pragma warning restore ASPIREPROCESSCOMMAND001
See also
Section titled “See also”- Process-backed resource commands — Learn how to use
WithProcessCommand