Charles HETIER
Charles HETIER

Reputation: 2074

Does a mvc6 service provides project.json data?

I am using asp.net 5 with mvc6, and I extended the project.json with several stuffs.

I am currently reading the project.json by parsing it myself. But I was wondering whether a service or a context exists within mvc6 already providing parsed data of project.json file.

Upvotes: 1

Views: 57

Answers (2)

Dawid Rutkowski
Dawid Rutkowski

Reputation: 2756

Why are you parsing manually project.json? Don't do that. If you wan't to have custom configuration settings then create new file or use one of existing ones (for example appsettings.json). Then in Startup.cs simply add that file and it will be available in the Configuration object:

public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");

    ...

    Configuration = builder.Build();
}

Upvotes: 0

davidfowl
davidfowl

Reputation: 38864

There's no service, you have to parse it yourself

Upvotes: 2

Related Questions