ExecutableResourceBuilderExtensions Methods
ClassMethods7 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[]?)extensionIResourceBuilder<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
namestringThe name of the resource.commandstringThe executable path. This can be a fully qualified path or a executable to run from the shell/command line.workingDirectory stringThe working directory of the executable.argsstring[]? 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[]?)extensionIResourceBuilder<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
namestringThe name of the resource.commandstringThe executable path. This can be a fully qualified path or a executable to run from the shell/command line.workingDirectory stringThe working directory of the executable.argsobject[]? The arguments to the executable.Returns
IResourceBuilder<ExecutableResource> The ApplicationModel.IResourceBuilder`1 .Remarks
This method is not available in polyglot AppHosts. Use the string[] overload instead.
PublishAsDockerFile(IResourceBuilder<T>) Section titled PublishAsDockerFile(IResourceBuilder<T>)extensionI Adds annotation to
ExecutableResource to support containerization during deployment. public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> PublishAsDockerFile<T>( this IResourceBuilder<T> builder) { // ... }}Parameters
builderIReturns
IResourceBuilder<T> A reference to the ApplicationModel.IResourceBuilder`1 .PublishAsDockerFile(IResourceBuilder<T>, IEnumerable<DockerBuildArg>) Section titled PublishAsDockerFile(IResourceBuilder<T>, IEnumerable<DockerBuildArg>)extensionI 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
builderIbuildArgs Idocker 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>>)extensionI 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
builderIconfigureAction<IResourceBuilder<ContainerResource>> Optional action to configure the container resourceReturns
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)extensionI Sets the command for the executable resource.
public static class ExecutableResourceBuilderExtensions{ public static IResourceBuilder<T> WithCommand<T>( this IResourceBuilder<T> builder, string command) { // ... }}Parameters
builderIcommandstringCommand.Returns
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1 .WithWorkingDirectory(IResourceBuilder<T>, string) Section titled WithWorkingDirectory(IResourceBuilder<T>, string)extensionI 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
builderIworkingDirectory stringWorking directory.Returns
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1 .