I'm developing an ASP.NET 5 WebAPI project using VS Ultimate 2015 Preview.
I'm trying to configure the app in this way:
using Microsoft.Framework.ConfigurationModel;
public IConfiguration Configuration { get; private set; }
public Startup()
{
Configuration = new Configuration()
.AddJsonFile("config.json")
.AddEnvironmentVariables();
}
Line 8 gives me an error:
'Configuration' does not contain a definition for 'AddJsonFile'...
What is wrong?
You need to include the
Microsoft.Extensions.Configuration.Json
NuGet package if you want to call the.AddJsonFile()
method.See: https://github.com/aspnet/Configuration/tree/dev/src/Microsoft.Framework.ConfigurationModel.Json
For further reading, here's a nice tutorial: ASP.NET vNext Moving Parts: IConfiguration.