Skip to content

After migrating to .NET 6 RC 1 No service for type Microsoft.Extensions.Configuration.IConfiguration can be found #36829

@marcuslindblom

Description

@marcuslindblom

In my IServiceCollection extension I have this code.

var serviceProvider = services.BuildServiceProvider();
var configuration = serviceProvider.GetRequiredService<IConfiguration>();

This breaks ofter migrating to .NET 6 using the Program.cs only and no Startup class.
Do I need to register this in my extension as well? How can I make this work for .NET 5 and .NET 6?

Metadata

Metadata

Assignees

Labels

✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-hostingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions