ExecutableResourceBuilderExtensions Methods
Class Methods 7 members
Provides extension methods for adding executable resources to the
IDistributedApplicationBuilder application model. AddExecutable(IDistributedApplicationBuilder, string, string, string, string[]?) Section titled AddExecutable(IDistributedApplicationBuilder, string, string, string, string[]?) extension IResourceBuilder<ExecutableResource> Adds an executable resource to the application model.
public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<ExecutableResource> AddExecutable( this IDistributedApplicationBuilder builder, string name, string command, string workingDirectory, params string[]? args) { // ... }}Parameters
name string The name of the resource. command string The executable path. This can be a fully qualified path or a executable to run from the shell/command line. workingDirectory string The working directory of the executable. args string[]? The arguments to the executable. Returns
IResourceBuilder<ExecutableResource> The ApplicationModel.IResourceBuilder`1. Remarks
You can run any executable command using its full path. As a security feature, Aspire doesn't run executable unless the command is located in a path listed in the PATH environment variable. To run an executable file that's in the current directory, specify the full path or use the relative path
./ to represent the current directory. AddExecutable(IDistributedApplicationBuilder, string, string, string, object[]?) Section titled AddExecutable(IDistributedApplicationBuilder, string, string, string, object[]?) extension IResourceBuilder<ExecutableResource> Adds an executable resource to the application model.
public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<ExecutableResource> AddExecutable( this IDistributedApplicationBuilder builder, string name, string command, string workingDirectory, params object[]? args) { // ... }}Parameters
name string The name of the resource. command string The executable path. This can be a fully qualified path or a executable to run from the shell/command line. workingDirectory string The working directory of the executable. args object[]? The arguments to the executable. Returns
IResourceBuilder<ExecutableResource> The ApplicationModel.IResourceBuilder`1. PublishAsDockerFile(IResourceBuilder<T>) Section titled PublishAsDockerFile(IResourceBuilder<T>) extension IResourceBuilder<T> Adds annotation to
ExecutableResource to support containerization during deployment. public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> PublishAsDockerFile<T>( this IResourceBuilder<T> builder) { // ... }}Parameters
builder IResourceBuilder<T> Resource builder Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1. PublishAsDockerFile(IResourceBuilder<T>, IEnumerable<DockerBuildArg>) Section titled PublishAsDockerFile(IResourceBuilder<T>, IEnumerable<DockerBuildArg>) extension IResourceBuilder<T> Adds annotation to
ExecutableResource to support containerization during deployment. The resulting container image is built, and when the optional buildArgs are provided they're used with docker build --build-arg. public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> PublishAsDockerFile<T>( this IResourceBuilder<T> builder, IEnumerable<DockerBuildArg>? buildArgs) { // ... }}Parameters
builder IResourceBuilder<T> Resource builder buildArgs IEnumerable<DockerBuildArg> The optional build arguments, used with docker build --build-args. Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1. PublishAsDockerFile(IResourceBuilder<T>, Action<IResourceBuilder<ContainerResource>>) Section titled PublishAsDockerFile(IResourceBuilder<T>, Action<IResourceBuilder<ContainerResource>>) extension IResourceBuilder<T> Adds support for containerizing this
ExecutableResource during deployment. The resulting container image is built, and when the optional configure action is provided, it is used to configure the container resource. public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> PublishAsDockerFile<T>( this IResourceBuilder<T> builder, Action<IResourceBuilder<ContainerResource>>? configure) { // ... }}Parameters
builder IResourceBuilder<T> Resource builder configure Action<IResourceBuilder<ContainerResource>> Optional action to configure the container resource Returns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
When the executable resource is converted to a container resource, the arguments to the executable are not used. This is because arguments to the executable often contain physical paths that are not valid in the container. The container can be set up with the correct arguments using the
configure action. WithCommand(IResourceBuilder<T>, string) Section titled WithCommand(IResourceBuilder<T>, string) extension IResourceBuilder<T> Sets the command for the executable resource.
public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> WithCommand<T>( this IResourceBuilder<T> builder, string command) { // ... }}Parameters
builder IResourceBuilder<T> Builder for the executable resource. command string Command. Returns
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1. WithWorkingDirectory(IResourceBuilder<T>, string) Section titled WithWorkingDirectory(IResourceBuilder<T>, string) extension IResourceBuilder<T> Sets the working directory for the executable resource.
public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> WithWorkingDirectory<T>( this IResourceBuilder<T> builder, string workingDirectory) { // ... }}Parameters
builder IResourceBuilder<T> Builder for the executable resource. workingDirectory string Working directory. Returns
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1.