microsoft/aspire · error · InvalidOperationException
Generated Deno Dockerfiles do not support
Error message
Generated Deno Dockerfiles do not support {publishMethod}. Use AddJavaScriptApp(...).WithDeno() or provide a custom Dockerfile. What it means
Aspire's auto-generated Deno Dockerfiles only support running a Deno app directly; they cannot serve a static website or a Node-style server build output. When the resource carries a JavaScriptPublishModeAnnotation of StaticWebsite or NodeServer, the library throws to stop an image that would not work. You must instead configure the resource via AddJavaScriptApp(...).WithDeno() or supply a custom Dockerfile.
Solutions
- Remove the PublishAsStaticWebsite()/PublishAsNodeServer() call from the Deno resource.
- Reconfigure the resource with AddJavaScriptApp(...).WithDeno() so the generated Dockerfile matches Deno semantics.
- Provide a custom Dockerfile (e.g. WithDockerFile/WithDockerfileBuilder) that handles static website or Node-server output yourself.
Example fix
// before
var deno = builder.AddJavaScriptApp("web", "main.ts")
.PublishAsStaticWebsite();
// after
var deno = builder.AddJavaScriptApp("web", "main.ts")
.WithDeno(); Defensive patterns
Strategy: validation
Validate before calling
// before publishing a Deno resource, verify no incompatible publish mode was set
if (resource.TryGetLastAnnotation<JavaScriptPublishModeAnnotation>(out var mode) &&
mode.Mode is JavaScriptPublishMode.StaticWebsite or JavaScriptPublishMode.NodeServer)
{
throw new InvalidOperationException("StaticWebsite/NodeServer publish modes are unsupported for generated Deno Dockerfiles.");
} Try / catch
try
{
builder.AddJavaScriptApp("web", "main.ts").WithDeno();
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Generated Deno Dockerfiles do not support"))
{
// remove PublishAsStaticWebsite/PublishAsNodeServer or switch to a custom Dockerfile
} Prevention
- Do not apply PublishAsStaticWebsite/PublishAsNodeServer to resources whose package manager is Deno.
- Call WithDeno() early so publish-mode validation happens against Deno semantics.
- Keep publish configuration per-resource rather than in shared loops over JavaScript resources.
When it happens
Trigger: Calling PublishAsStaticWebsite() or PublishAsNodeServer() on a Deno-based JavaScript app resource, then publishing/generating its Dockerfile, so ThrowIfUnsupportedDenoDockerfileOptions (invoked from resourceBuilder) sees the incompatible JavaScriptPublishModeAnnotation.
Common situations: Copying a publish configuration from an npm/Node project onto a Deno app; a shared extension method that applies PublishAsStaticWebsite to every JavaScript resource; switching a resource's package manager to Deno after it was already set up as a static website.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Generated Deno Dockerfiles do not support alternate package…
- ASPIRERADIUS011
- Deno command-line options configured with the WithDeno*…
- DockerfileBuildAnnotation should exist after calling…
- Generated Deno Dockerfiles do not support '--env-file'…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/c3dac45eb461b02e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs:954
entrypoint.Add("--allow-net");
entrypoint.Add("--allow-env");
entrypoint.Add("--cached-only");
entrypoint.Add(containerScriptPath);
}
NormalizeDenoContainerPathArguments(entrypoint);
return [.. entrypoint];
}
private static void ThrowIfUnsupportedDenoDockerfileOptions(IResource resource)
{
if (resource.TryGetLastAnnotation<JavaScriptPublishModeAnnotation>(out var publishMode) &&
publishMode.Mode is JavaScriptPublishMode.StaticWebsite or JavaScriptPublishMode.NodeServer)
{
var publishMethod = publishMode.Mode == JavaScriptPublishMode.StaticWebsite
? nameof(PublishAsStaticWebsite)
: nameof(PublishAsNodeServer);
throw new InvalidOperationException($"Generated Deno Dockerfiles do not support {publishMethod}. Use AddJavaScriptApp(...).WithDeno() or provide a custom Dockerfile.");
}
if (resource.TryGetLastAnnotation<JavaScriptPackageManagerAnnotation>(out var packageManager) &&
!string.Equals(packageManager.ExecutableName, "deno", StringComparison.Ordinal))
{
throw new InvalidOperationException($"Generated Deno Dockerfiles do not support alternate package manager '{packageManager.ExecutableName}'. Use WithDeno() or provide a custom Dockerfile.");
}
if (resource.TryGetLastAnnotation<DenoCommandLineAnnotation>(out var deno) &&
deno.NodeModulesDirSet &&
deno.NodeModulesDirMode == DenoNodeModulesDirMode.Manual)
{
throw new InvalidOperationException("The 'manual' node_modules mode is not supported by generated Deno Dockerfiles because node_modules is excluded from the build context. Use the 'auto' mode or provide a custom Dockerfile.");
}
if (deno is not null)
{
if (deno.RuntimeArgs.Any(argument =>View on GitHub (pinned to 25830f84bd)