Build failing on .net Core app due to missing definition

前端 未结 3 2135
别跟我提以往
别跟我提以往 2021-02-18 14:27

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

相关标签:
3条回答
  • 2021-02-18 14:53

    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.

    0 讨论(0)
  • 2021-02-18 14:53

    The correct package to add for .AddEnvironmentVariables() is Microsoft.Extensions.Configuration.EnvironmentVariables

    0 讨论(0)
  • 2021-02-18 15:09

    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.

    0 讨论(0)
提交回复
热议问题