microsoft/aspire · error · DistributedApplicationException
Resource ' ' is a DotnetProjectResource. Automatic project…
Error message
Resource '{resourceNames[0]}' is a DotnetProjectResource. Automatic project publishing for this experimental resource type is not supported. For a C# AppHost project reference, use AddProject<TProject>(...). For a path-based project or file-based app, use AddCSharpApp(...) in C# or addCSharpApp(...) in TypeScript. To publish this resource using explicit container configuration, call PublishAsDockerFile(...) in C# or publishAsDockerFile(...) in TypeScript. If it is intentionally run-only, call ExcludeFromManifest() in C# or excludeFromManifest() in TypeScript. What it means
Error "Resource '{resourceNames[0]}' is a DotnetProjectResource. Automatic project publishing for this experimental resource type is not supported. For a C# AppHost project reference, use AddProject<TProject>(...). For a path-based project or file-based app, use AddCSharpApp(...) in C# or addCSharpApp(...) in TypeScript. To publish this resource using explicit container configuration, call PublishAsDockerFile(...) in C# or publishAsDockerFile(...) in TypeScript. If it is intentionally run-only, call ExcludeFromManifest() in C# or excludeFromManifest() in TypeScript." thrown in microsoft/aspire.
Solutions
- Use AddProject<TProject>(...) for C# AppHost project references
- Use AddCSharpApp(...) (C#) or addCSharpApp(...) (TypeScript) for path-based projects and file-based apps
- Call PublishAsDockerFile(...) / publishAsDockerFile(...) to publish with explicit container configuration
- Call ExcludeFromManifest() / excludeFromManifest(...) if the resource is intentionally run-only
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs:90 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/eedf8cb43450fdf6.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs:90
Annotations.Add(new PipelineStepAnnotation(context =>
{
var unsupportedResources = context.PipelineContext.Model.Resources
.OfType<DotnetProjectResource>()
.Where(static resource => resource.RequiresPublishValidation())
.ToArray();
if (unsupportedResources.Length == 0 || !ReferenceEquals(context.Resource, unsupportedResources[0]))
{
return [];
}
return
[
new PipelineStep
{
Name = ValidateDotnetProjectPublishStepName,
Description = "Validates publish support for .NET project resources.",
Action = _ => throw new DistributedApplicationException(
GetUnsupportedPublishMessage(unsupportedResources.Select(resource => resource.Name).ToArray())),
Resource = unsupportedResources[0]
}
];
}));
// Configuration callbacks run in model order, so later compute-environment callbacks may not have attached
// build and push work to publish or deploy yet. Use those steps' stable aggregation roots to add the
// validation dependency before any step action can be scheduled.
Annotations.Add(new PipelineConfigurationAnnotation(context =>
{
var validationStep = context.Steps.SingleOrDefault(step =>
step.Name == ValidateDotnetProjectPublishStepName &&
step.Resource is DotnetProjectResource resource &&
resource.RequiresPublishValidation());
if (validationStep is null)
{View on GitHub (pinned to 25830f84bd)