DotnetProjectResource

Classnet10.0
📦 Aspire.Hosting.Dotnet v17.0.0
A resource that represents an SDK-style .NET project or file-based C# 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).

Supported project files are .csproj, .fsproj, and .vbproj. F# scripts and non-SDK project systems are not supported.

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.