Setting Base Path using ConfigurationBuilder
I was able to solve the issue. If you have not yet solved it, try the following in the project.json. Add the following:
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-*",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final"
and it should work
Not sure if anyone still runs into this issue but I was able to address this in a dotnetcore console project (netcoreapp2.0) via:
dotnet add package Microsoft.Extensions.Configuration.Json
Try adding the following in your .csproj
file:
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
</ItemGroup>
Something else to consider:
using Microsoft.Extensions.Configuration;
Without that "using" statement, it doesn't find the extension method in Microsoft.Extensions.Configuration.FileExtensions.
The trouble cropped up for me because we were also:
using System.Configuration;
And there was a name clash with "ConfigurationBuilder". Add the
using Microsoft.Extensions.Configuration;
line... remove the
using System.Configuration;
line, then fully qualify anything under System.Configuration.