You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fundamentals/app-host-overview.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,11 +130,16 @@ Aspire projects are made up of a set of resources. The primary base resource typ
130
130
| Method | Resource type | Description |
131
131
|--|--|--|
132
132
|<xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject%2A>|<xref:Aspire.Hosting.ApplicationModel.ProjectResource>| A .NET project, for example, an ASP.NET Core web app. |
133
+
|`AddCSharpApp`|`CSharpAppResource`| A C# project or file-based app, for example, a _*.cs_ file, _*.csproj_ file, or project directory. |
133
134
|<xref:Aspire.Hosting.ContainerResourceBuilderExtensions.AddContainer%2A>|<xref:Aspire.Hosting.ApplicationModel.ContainerResource>| A container image, such as a Docker image. |
134
135
|<xref:Aspire.Hosting.ExecutableResourceBuilderExtensions.AddExecutable%2A>|<xref:Aspire.Hosting.ApplicationModel.ExecutableResource>| An executable file, such as a [Node.js app](../get-started/build-aspire-apps-with-nodejs.md). |
135
136
|<xref:Aspire.Hosting.ParameterResourceBuilderExtensions.AddParameter%2A>|<xref:Aspire.Hosting.ApplicationModel.ParameterResource>| A parameter resource that can be used to [express external parameters](external-parameters.md). |
136
137
137
-
Project resources represent .NET projects that are part of the app model. When you add a project reference to the AppHost project, the Aspire SDK generates a type in the `Projects` namespace for each referenced project. For more information, see [Aspire SDK: Project references](dotnet-aspire-sdk.md#project-references).
138
+
<!-- TODO: add when xref is ready.
139
+
| <xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddCSharpApp%2A> | <xref:Aspire.Hosting.ApplicationModel.CSharpAppResource> | A C# project or file-based app, for example, a .cs file, .csproj file, or project directory. |
140
+
-->
141
+
142
+
Project resources represent .NET projects that are part of the app model. When you add a project reference to the AppHost project, the Aspire SDK generates a type in the `Projects` namespace for each referenced project. For more information, see [Aspire SDK: Project references](dotnet-aspire-sdk.md#project-references). Alternatively, you can add C# projects or file-based apps without a project reference using the `AddCSharpApp` method.
138
143
139
144
To add a project to the app model, use the <xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject%2A> method:
140
145
@@ -157,6 +162,25 @@ var apiservice = builder.AddProject<Projects.AspireApp_ApiService>("apiservice")
157
162
158
163
The preceding code adds three replicas of the "apiservice" project resource to the app model. For more information, see [Aspire dashboard: Resource replicas](dashboard/explore.md#resource-replicas).
159
164
165
+
C# app resources represent C# projects or file-based apps that are part of the app model. Unlike <xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject%2A>, which requires a project reference, the `AddCSharpApp` method can add C# projects or file-based apps using a path to a _*.cs_ file, _*.csproj_ file, or project directory. This is useful for adding file-based apps introduced in .NET 10 or for including projects without adding a project reference to the AppHost.
166
+
167
+
To add a C# app to the app model, use the `AddCSharpApp` method:
The `AddCSharpApp` method supports the same configuration options as <xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject%2A>, including replicas, environment variables, and resource dependencies.
180
+
181
+
> [!NOTE]
182
+
> The `AddCSharpApp` method is marked as experimental and requires .NET 10 SDK for file-based C# app support. For more information on file-based apps, see the [What's new in Aspire 9.5](../whats-new/dotnet-aspire-9.5.md#file-based-apphost-support-preview) documentation.
183
+
160
184
## Reference resources
161
185
162
186
A reference represents a dependency between resources. For example, you can probably imagine a scenario where a web frontend depends on a Redis cache. Consider the following example AppHost `Program` C# code:
0 commit comments