Skip to content

Support for older ASP.NET Core hosting models - IWebHost, IHostBuilder  #1057

Closed as duplicate
@Swellenator

Description

@Swellenator

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions