Skip to content
Docs Try Aspire

Compiler Warning ASPIRECONTAINERSHELLEXECUTION001

Version introduced: 9.3

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.

The following code generates ASPIRECONTAINERSHELLEXECUTION001:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var container = builder.AddContainer("mycontainer", "myimage");
container.ShellExecution = true;

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 = 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);ASPIRECONTAINERSHELLEXECUTION001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIRECONTAINERSHELLEXECUTION001 directive:

    C# — Suppressing the warning
    #pragma warning disable ASPIRECONTAINERSHELLEXECUTION001
    container.ShellExecution = true;
    #pragma warning restore ASPIRECONTAINERSHELLEXECUTION001