microsoft/aspire · error · DistributedApplicationException

The '--output-path [path]' option was not specified even…

Error message

The '--output-path [path]' option was not specified even though manifest publishing was requested.

What it means

Manifest publishing is requested via --publisher manifest, but the mandatory --output-path option is missing, so the publisher has nowhere to write the manifest. The check in AddManifestPublishing's callback fails fast at app start rather than producing an empty or misplaced manifest.

Solutions

  1. Add --output-path to the command: `dotnet run --publisher manifest --output-path ./aspire-manifest.json`.
  2. Update CI/deploy scripts to include --output-path when manifest publishing is requested.
  3. If you did not intend to publish a manifest, remove the --publisher/--publish flags.

Example fix

// before
dotnet run --publisher manifest
// after
dotnet run --publisher manifest --output-path ./aspire-manifest.json
Defensive patterns

Strategy: validation

Validate before calling

if (args.Contains("--publisher") && !args.Contains("--output-path"))
{
    throw new ArgumentException("--output-path is required when --publisher is specified.");
}

Try / catch

catch (DistributedApplicationException ex) when (ex.Message.Contains("--output-path"))
{
    // print usage guidance
}

Prevention

When it happens

Trigger: Running the AppHost with `dotnet run --publisher manifest` (or --publish-type manifest via aspire publish path) without `--output-path <file>`; CI scripts invoking manifest publishing that omit the flag.

Common situations: Command-line typos or dropped arguments when generating a deployment manifest; older scripts written before the output-path requirement; hand-typed publish commands.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/1f8ba1ea8c79d74a. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting/Publishing/ManifestPublishingExtensions.cs:40

    /// <param name="pipeline">The pipeline to add the manifest publishing step to.</param>
    /// <returns>The pipeline for chaining.</returns>
    [AspireExportIgnore(Reason = "Manifest publishing is an internal pipeline step and not part of the polyglot AppHost surface.")]
    public static IDistributedApplicationPipeline AddManifestPublishing(this IDistributedApplicationPipeline pipeline)
    {
        var step = new PipelineStep
        {
            Name = "publish-manifest",
            Description = "Publishes the Aspire application model as a JSON manifest file.",
            Action = async context =>
            {
                var loggerFactory = context.Services.GetRequiredService<ILoggerFactory>();
                var logger = loggerFactory.CreateLogger("Aspire.Hosting.Publishing.ManifestPublisher");
                var pipelineOptions = context.Services.GetRequiredService<IOptions<PipelineOptions>>();
                var executionContext = context.Services.GetRequiredService<DistributedApplicationExecutionContext>();

                if (pipelineOptions.Value.OutputPath == null)
                {
                    throw new DistributedApplicationException(
                        "The '--output-path [path]' option was not specified even though manifest publishing was requested."
                        );
                }

                var outputPath = pipelineOptions.Value.OutputPath;

                if (!outputPath.EndsWith(".json", StringComparison.Ordinal))
                {
                    // If the manifest path ends with .json we assume that the output path was specified
                    // as a filename. If not, we assume that the output path was specified as a directory
                    // and append aspire-manifest.json to the path. This is so that we retain backwards
                    // compatibility with AZD, but also support manifest publishing via the Aspire CLI
                    // where the output path is a directory (since not all publishers use a manifest).
                    outputPath = Path.Combine(outputPath, "aspire-manifest.json");
                }

                var parentDirectory = Directory.GetParent(outputPath);
                if (!Directory.Exists(parentDirectory!.FullName))

View on GitHub (pinned to 25830f84bd)