Skip to content
DocsTry Aspire
DocsTry

DotnetProjectResource

Classnet10.0
📦 Aspire.Hosting.Dotnet v13.5.3-preview.1.26425.3
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.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
Aspire.Hosting.IResourceWithServiceDiscovery
{
// ...
}
ExecutableResourceIResourceIResourceWithEndpointsIResourceWithServiceDiscovery

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).

Automatic publishing is not supported. Use AddProject<TProject>(...) or AddCSharpApp(...) for standard .NET project publishing, explicitly configure container publishing with PublishAsDockerFile(...), or exclude an intentionally run-only resource with ExcludeFromManifest().