ProjectResourceBuilderExtensions.AddCSharpApp Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| AddCSharpApp(IDistributedApplicationBuilder, String, String) |
Adds a C# project or file-based app to the application model. |
| AddCSharpApp(IDistributedApplicationBuilder, String, String, Action<ProjectResourceOptions>) |
Adds a C# project or file-based app to the application model. |
AddCSharpApp(IDistributedApplicationBuilder, String, String)
Adds a C# project or file-based app to the application model.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ProjectResource> AddCSharpApp(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string path);
static member AddCSharpApp : Aspire.Hosting.IDistributedApplicationBuilder * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ProjectResource>
<Extension()>
Public Function AddCSharpApp (builder As IDistributedApplicationBuilder, name As String, path As String) As IResourceBuilder(Of ProjectResource)
Parameters
- name
- String
The name of the resource. This name will be used for service discovery when referenced in a dependency.
- path
- String
The path to the file-based app file, project file, or project directory.
Returns
A reference to the IResourceBuilder<T>.
Remarks
This overload of the AddCSharpApp(IDistributedApplicationBuilder, String, String) method adds a C# project or file-based app to the application model using a path to the file-based app .cs file, project file (.csproj), or project directory. If the path is not an absolute path then it will be computed relative to the app host directory.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddCSharpApp("inventoryservice", @"..\InventoryService.cs");
builder.Build().Run();
Applies to
AddCSharpApp(IDistributedApplicationBuilder, String, String, Action<ProjectResourceOptions>)
Adds a C# project or file-based app to the application model.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.CSharpAppResource> AddCSharpApp(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string path, Action<Aspire.Hosting.ProjectResourceOptions> configure);
static member AddCSharpApp : Aspire.Hosting.IDistributedApplicationBuilder * string * string * Action<Aspire.Hosting.ProjectResourceOptions> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.CSharpAppResource>
<Extension()>
Public Function AddCSharpApp (builder As IDistributedApplicationBuilder, name As String, path As String, configure As Action(Of ProjectResourceOptions)) As IResourceBuilder(Of CSharpAppResource)
Parameters
- name
- String
The name of the resource. This name will be used for service discovery when referenced in a dependency.
- path
- String
The path to the file-based app file, project file, or project directory.
- configure
- Action<ProjectResourceOptions>
An optional action to configure the C# app resource options.
Returns
A reference to the IResourceBuilder<T>.
Remarks
This overload of the AddCSharpApp(IDistributedApplicationBuilder, String, String) method adds a C# project or file-based app to the application model using a path to the file-based app .cs file, project file (.csproj), or project directory. If the path is not an absolute path then it will be computed relative to the app host directory.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddCSharpApp("inventoryservice", @"..\InventoryService.cs", o => o.LaunchProfileName = "https");
builder.Build().Run();