Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

Compiler Error ASPIREAZURE005

Version introduced: 17.0

‘Aspire.Hosting.Azure.IBicepOutputReferenceProvider’ is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

The IBicepOutputReferenceProvider interface represents a value that’s published as a Bicep output reference, even though the output isn’t known when the value is created. For example, a value might refer to the client ID of a managed identity that Aspire creates only while it prepares the app model for publishing. The interface has a single method, GetOutputReference, which returns the BicepOutputReference to use, or null when no output is available. Azure publishers treat a value that implements this interface as the output that it returns.

This interface is experimental and might change in future releases. The C# compiler reports ASPIREAZURE005 when your code uses it.

The following code generates ASPIREAZURE005:

DeferredOutputValue.cs
using Aspire.Hosting.Azure;
// Implementing IBicepOutputReferenceProvider generates ASPIREAZURE005
internal sealed class DeferredOutputValue(Func<BicepOutputReference?> resolve)
: IBicepOutputReferenceProvider
{
public BicepOutputReference? GetOutputReference() => resolve();
}

TypeScript AppHosts can’t use this interface, so they don’t report this diagnostic.

Suppress the error with one of the following methods:

  • Set the severity of the rule in the .editorconfig file.

    .editorconfig
    [*.{cs,vb}]
    dotnet_diagnostic.ASPIREAZURE005.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);ASPIREAZURE005</NoWarn>
    </PropertyGroup>
  • Add the following property directive to a file-based AppHost:

    AppHost.cs
    #:property NoWarn=ASPIREAZURE005
  • Suppress in code with the #pragma warning disable ASPIREAZURE005 directive:

    Suppressing the error
    #pragma warning disable ASPIREAZURE005
    internal sealed class DeferredOutputValue(Func<BicepOutputReference?> resolve)
    : IBicepOutputReferenceProvider
    {
    public BicepOutputReference? GetOutputReference() => resolve();
    }
    #pragma warning restore ASPIREAZURE005