Skip to content
DocsTry Aspire
DocsTry

Compiler Warning ASPIREACANAMING001

Version introduced: 13.2

WithCompactResourceNaming is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warning is reported when using the experimental WithCompactResourceNaming extension method on an Azure Container App environment. This API opts the environment into shorter, compact names for the volume-backing Azure Storage resources that Aspire provisions, which avoids storage-account name-length collisions when the environment name is long. It doesn’t rename the Container App environment, container registry, Log Analytics workspace, or managed identity.

The following code generates ASPIREACANAMING001:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
builder.AddAzureContainerAppEnvironment("env")
.WithCompactResourceNaming();
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.ASPIREACANAMING001.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);ASPIREACANAMING001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIREACANAMING001 directive:

    Suppressing the warning
    #pragma warning disable ASPIREACANAMING001
    builder.AddAzureContainerAppEnvironment("env")
    .WithCompactResourceNaming();
    #pragma warning restore ASPIREACANAMING001