AddConfiguration来自哪里?

时间:2018-05-11 15:57:01

标签: c# asp.net-core

在net core 2.0上,调用AddConfiguration,如下所示:

logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));

https://github.com/aspnet/MetaPackages/blob/rel/2.0.3/src/Microsoft.AspNetCore/WebHost.cs

我正在尝试创建自己的自定义CreateDefaultBuilder,但我不知道要包含哪些程序集以使AddConfiguration可用。

目前我必须包含以下套餐..但有些人错过了

Microsoft.Extensions.Configuration.UserSecrets         
Microsoft.AspNetCore.Server.Kestrel                    
Microsoft.Extensions.Configuration.Json                
Microsoft.Extensions.DependencyInjection               
Microsoft.Extensions.Logging.Debug                     
Microsoft.Extensions.Logging                           
Microsoft.Extensions.Options.ConfigurationExtensions   
Microsoft.Extensions.Logging.Console                   
Microsoft.NETCore.App                                  
Microsoft.Extensions.Configuration.CommandLine         
Microsoft.AspNetCore.Server.Kestrel.Https              
Microsoft.Extensions.Configuration.EnvironmentVariables
Microsoft.AspNetCore.Server.IISIntegration 

1 个答案:

答案 0 :(得分:0)

谢谢伊万

Install-Package Microsoft.Extensions.Logging.Configuration

解决了问题