Skip to content
DocsTry Aspire
DocsTry

ProjectLaunchArgsOverrideAnnotation Constructors

ClassConstructors1 member
Represents an annotation that overrides the default project launch arguments generated by DCP for a ProjectResource.
Constructor(IReadOnlyList<string>, string?)Section titled Constructor(IReadOnlyList<string>, string?)
Represents an annotation that overrides the default project launch arguments generated by DCP for a ProjectResource.
public sealed class ProjectLaunchArgsOverrideAnnotation
{
public ProjectLaunchArgsOverrideAnnotation(
IReadOnlyList<string> arguments,
string? leadingResourceArgumentToRemove = null)
{
// ...
}
}
argumentsIReadOnlyList<string>The custom launch arguments to use instead of the default project launch arguments.
leadingResourceArgumentToRemovestring?optionalThe optional first resource argument to omit from the final launch arguments when it is already represented by arguments.

When this annotation is present on a ProjectResource, DCP will use the provided arguments as the base command (e.g., build /t:Run) instead of the default run verb. DCP still appends the project path positionally and appends --configuration automatically; only the verb and its options are overridden. This annotation is intended for verbs like build that accept the project path as a positional argument. The --no-launch-profile flag is omitted when this annotation is present.

A non-empty launch-tool argument callback replaces this base command. If the callback resolves no arguments, this override remains the Process command.

Override DCP's default launch to use dotnet build /t:Run:

builder.WithAnnotation(new ProjectLaunchArgsOverrideAnnotation(["build", "/t:Run"]));