microsoft / microsoft/aspire

[WebToolsE2E] Using VS Code C# Dev Kit, when we add Aspire orchestration to function app, it missed adding the function app project to the IDistributedApplicationBuilder and the package 'Aspire.Hosting.Azure.Functions' was missing.

Open
#7,974 1 comment 0 reactions 0 assignees View on GitHub
area-tooling azure-functions
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

**REGRESSION INFO**: Not a regression

**INSTALL STEPS**

1. Clean machine: Win11 x64 ENU
2. Install SDK 9.0.200 (latest-released-version)
3. Install Aspire templates 9.1 (latest-released-version)
- `dotnet new install Aspire.ProjectTemplates`
4. Install VS Code + C# Dev Kit extension (latest pre-release version 1.17.48)
5. Install the latest released Azure Functions Extension

**REPRO STEPS**

1. Using VS Code, select Azure Functions explorer > Create Function > .NET 9.0 Isolated > HTTP trigger > `FunctionApp1` > Select "Function" > Select "Open in current windows".
2. Go to Explorer tab, right-click solution node > Add .NET Aspire Orchestration > select `FunctionApp1` as the project to be orchestrated.
3. For the names of AppHost and ServiceDefaults projects, set the values to be `FunctionApp1.AppHost` and `FunctionApp1.ServiceDefaults`.

**ACTUAL**
Aspire orchestration support gets added but it is incomplete

1. In the Program.cs of `FunctionApp1.AppHost`, the critical line of adding the function app project to the IDistributedApplicationBuilder is missing. Without this line, the dashboard will be blank when we run the AppHost.

![Image](https://github.com/user-attachments/assets/3c1f017b-7b39-4c03-af31-d7073aa32312)

2. In the `FunctionApp1.AppHost.csproj` file, the package 'Aspire.Hosting.Azure.Functions' is missing

![Image](https://github.com/user-attachments/assets/f39fd6a1-64c2-4f2a-9be0-720124e00905)

**EXPECTED**
Missing orchestration support code and function package should get properly added.

1. In the Program.cs of `FunctionApp1.AppHost`, we should add the function app project to the IDistributedApplicationBuilder as follows.

![Image](https://github.com/user-attachments/assets/1fae241b-e77b-4741-8950-169ee6f431e4)

2. In the `FunctionApp1.AppHost.csproj` file, the package 'Aspire.Hosting.Azure.Functions' should be installed automatically.

![Image](https://github.com/user-attachments/assets/591541cb-c657-4018-82e5-f7c043e673fe)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.