Share via


JavaScriptHostingExtensions.WithRunScript<TResource> Method

Definition

Adds a run script annotation to the specified JavaScript application resource builder, specifying the script to execute and its arguments during run mode.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<TResource> WithRunScript<TResource>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<TResource> resource, string scriptName, string[]? args = default) where TResource : Aspire.Hosting.JavaScript.JavaScriptAppResource;
static member WithRunScript : Aspire.Hosting.ApplicationModel.IResourceBuilder<'Resource (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)> * string * string[] -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'Resource (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)> (requires 'Resource :> Aspire.Hosting.JavaScript.JavaScriptAppResource)
<Extension()>
Public Function WithRunScript(Of TResource As JavaScriptAppResource) (resource As IResourceBuilder(Of TResource), scriptName As String, Optional args As String() = Nothing) As IResourceBuilder(Of TResource)

Type Parameters

TResource

The type of the JavaScript application resource being configured. Must inherit from JavaScriptAppResource.

Parameters

resource
IResourceBuilder<TResource>

The resource builder to which the run script annotation will be added.

scriptName
String

The name of the script to be executed when the resource is run.

args
String[]

An array of arguments to pass to the script.

Returns

IResourceBuilder<TResource>

The same resource builder instance with the run script annotation applied, enabling further configuration.

Remarks

Use this method to specify a custom script and its arguments that should be executed when the resource is executed in RunMode.

Applies to