dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.93k stars 480 forks source link

Incorrect message instructing users to install the Aspire Workload when the new Aspire SDK fails to restore #6549

Open joperezr opened 4 weeks ago

joperezr commented 4 weeks ago

When doing some testing yesterday, @davidfowl found that in the case you are missing feeds or something else causes the restore of the new Aspire SDK to fail, then you will get a message saying that you need to install the aspire sdk workload. The reason why this happens is that there is a property in the projects called IsAspireAppHost which is set to true, and that triggers the import of the legacy Aspire Workload targets, but this doesn't happen in 9.0 because the new Aspire SDK will set another property SkipAspireWorkloadManifest which will override that behavior and skip the import of the workload targets. The problem David was hitting, was that because the Aspire SDK was failing to restore, then SkipAspireWorkloadManifest wasn't being set, and therefore the project was trying to import the workload targets which were failing as the workload wasn't installed. He was seeing:

To build this project, the following workloads must be installed: aspire
  To install these workloads, run the following command: dotnet workload restore
Restore failed.

We could avoid this by moving the property of IsAspireAppHost to the new Aspire SDK and remove it from the templates, as that way if the SDK fails to restore, then the workload targets wouldn't be triggered. It would also help to simplify the templates as there is one less property set.

It may be too late to take this change for Aspire 9 (as this does impact the templates), but logging the issue so we track fixing this either now or on 9.1.