Multi-targeted AppHost fails to build: error MSB4036: The "Microsoft.NET.Build.Tasks.PickBestRid" task was not found
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 201
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
With Aspire 13.4, when the the AppHost is multi-targeted (`TargetFrameeworks` property used instead of `TargetFramework`), the project fails to build because of a missing task:
```
F:\.nuget\packages\aspire.apphost.sdk\13.4.2\Sdk\Sdk.targets(143,5): error MSB4036: The "Microsoft.NET.Build.Tasks.PickBestRid" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\10.0.300" directory.
```
This works fine with the latest 13.3 version
### Expected Behavior
I expect the AppHost to be able to build when it is multi-targeted.
### Steps To Reproduce
1. `dotnet new aspire-apphost`
2. In the .csproj, change `net10.0` to `net10.0`
3. `dotnet build`
### Exceptions (if any)
Build error:
```
F:\.nuget\packages\aspire.apphost.sdk\13.4.2\Sdk\Sdk.targets(143,5): error MSB4036: The "Microsoft.NET.Build.Tasks.PickBestRid" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files\dotnet\sdk\10.0.300" directory.
```
### Aspire doctor output
Aspire Environment Check
========================
Aspire
✅ Aspire CLI version 13.4.2 (channel: stable)
AppHost
⚠️ Could not determine AppHost version (repro.csproj)
.NET SDK
✅ .NET 10.0.300 installed (x64)
Container Runtime
✅ Docker v29.5.2: running (auto-detected (default)) ← active
Environment
✅ HTTPS development certificate is trusted
Summary: 4 passed, 1 warnings, 0 failed
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.