I have just updated an existing ASP.NET Core app to .NET 8. I tried to add .NET Aspire Orchestrator support via the Visual Studio tooling and received this error:
Microsoft Visual Studio Failed to insert code for project [ApiProject]. Cant find a call to method(s) Build on type Microsoft.AspNetCore.BuiIder.WebAppIicationBuiIder in the program main.
After some digging I have concluded it is due to an older unsupported hosting model, IWebHost. I updated to a newer IHostBuilder, but still no luck. It looks like ASP.NET Aspire requires IHostApplicationBuilder.
I think this should be made clearer at least in the documentation. It would be good to have a note stating that you need to be using IHostApplicationBuilder not just .NET 8.
I would also consider making the error from the tooling a bit better. It is clear from the Extensions part of ServiceDefaults project that you need to use IHostApplicationBuilder, but when relying on tooling the error message doesn't help that much.
I have just updated an existing ASP.NET Core app to .NET 8. I tried to add .NET Aspire Orchestrator support via the Visual Studio tooling and received this error:
Microsoft Visual Studio Failed to insert code for project [ApiProject]. Cant find a call to method(s) Build on type Microsoft.AspNetCore.BuiIder.WebAppIicationBuiIder in the program main.
After some digging I have concluded it is due to an older unsupported hosting model,
IWebHost
. I updated to a newerIHostBuilder
, but still no luck. It looks like ASP.NET Aspire requiresIHostApplicationBuilder
.I think this should be made clearer at least in the documentation. It would be good to have a note stating that you need to be using
IHostApplicationBuilder
not just .NET 8.I would also consider making the error from the tooling a bit better. It is clear from the
Extensions
part ofServiceDefaults
project that you need to useIHostApplicationBuilder
, but when relying on tooling the error message doesn't help that much.