首页新闻找找看学习计划

ASP.NET Core RC2: 'ConfigurationBuilder' does not contain a definition for 'SetBasePath'

0
悬赏园豆:10 [已解决问题] 解决于 2016-05-17 18:31

用 dotnet build 命令编译 ASP.NET Core RC2 站点时出现如下的错误:

Startup.cs(24,6): error CS1061: 'ConfigurationBuilder' does not contain a definition for 'SetBasePath' and no extension method 'SetBasePath' accepting a first argument of type 'ConfigurationBuilder' could be found (are you missing a using directive or an assembly reference?)

Startup.cs 中的对应代码如下:

public Startup(IHostingEnvironment hostingEnv)
{
    IConfigurationBuilder builder = new ConfigurationBuilder()
        .SetBasePath(hostingEnv.ContentRootPath)
        .AddJsonFile("config.json", false);
    Configuration = builder.Build();
}
dudu的主页 dudu | 高人七级 | 园豆:39845
提问于:2016-05-17 18:18
< >
分享
最佳答案
0

在project.json中添加如下的配置:

"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-*"
dudu | 高人七级 |园豆:39845 | 2016-05-17 18:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册