Watch Aspire live streamsDocsTry Aspire

DotnetProjectResource

Classnet10.0
📦 Aspire.Hosting.Dotnet v13.6.0-preview.1.26478.8
A resource that represents a specified C# project or file-based app added by path.
namespace Aspire.Hosting.Dotnet;
public class DotnetProjectResource
: Aspire.Hosting.ApplicationModel.ExecutableResource,
Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource,
Aspire.Hosting.ApplicationModel.IDotnetProgramResource,
Aspire.Hosting.ApplicationModel.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
Aspire.Hosting.IResourceWithServiceDiscovery
{
// ...
}
ExecutableResourceIContainerFilesDestinationResourceIDotnetProgramResourceIResourceIResourceWithEndpointsIResourceWithServiceDiscovery

A DotnetProjectResource is added by path and is launched as an executable: dotnet run --project <path> for a project file, or dotnet run --file <path> for a file-based app (a .cs file).

Resources created by AddDotnetProject support the same .NET SDK container-publishing pipeline as resources created by AddProject. A directly constructed resource must be given project metadata and explicitly configured for publishing by its builder.