Compiler Warning ASPIRECONTAINERSHELLEXECUTION001
The container shell execution property is experimental and subject to change or removal in future updates. Suppress this diagnostic to proceed.
The ShellExecution property on ContainerResource is an experimental feature that controls whether custom arguments should be wrapped for shell execution. When enabled, custom arguments are wrapped in -c "values" format for shell execution.
Example
Section titled “Example”The following code generates ASPIRECONTAINERSHELLEXECUTION001:
var builder = DistributedApplication.CreateBuilder(args);
var container = builder.AddContainer("mycontainer", "myimage");container.ShellExecution = true;To correct this warning
Section titled “To correct this warning”Suppress the warning with either of the following methods:
-
Set the severity of the rule in the .editorconfig file.
.editorconfig [*.{cs,vb}]dotnet_diagnostic.ASPIRECONTAINERSHELLEXECUTION001.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);ASPIRECONTAINERSHELLEXECUTION001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disable ASPIRECONTAINERSHELLEXECUTION001directive:C# — Suppressing the warning #pragma warning disable ASPIRECONTAINERSHELLEXECUTION001container.ShellExecution = true;#pragma warning restore ASPIRECONTAINERSHELLEXECUTION001