I\'m trying to build my .NET Core app from the CLI using dotnet build
, but every single time I get this error:
\'IConfigurationBuilder\' doe
You need the Microsoft.Extensions.Configuration namespace in scope to get that extension method. Either fully qualify it, or add this to the top of your file:
using Microsoft.Extensions.Configuration;
You also will need the NuGet reference Microsoft.Extensions.Configuration.EnvironmentVariables.
The correct package to add for .AddEnvironmentVariables()
is Microsoft.Extensions.Configuration.EnvironmentVariables
I tried Microsoft.Extensions.Configuration.EnvironmentVariables but with no luck. I already had Microsoft.Extensions.Configuration from NuGet. I added Microsoft.Extensions.Configuration.UserSecrets and then it worked.