Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you transform a *.json file in VS2015

I'm trying out VS2015 with all the new features and I was wondering if I can still apply a tranformation on the project.json or config.json file? Like what we could do with web.config => web.Debug.config and web.Release.config.

like image 487
Ken Bonny Avatar asked Dec 09 '14 12:12

Ken Bonny


1 Answers

Just in case someone else comes across this. While you cant do XDT Transformations. With Config.json you can add environment specific configurations.

// Setup configuration sources.
var configuration = new Configuration()
    .AddJsonFile("config.json")
    .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);

if (env.IsEnvironment("Development"))
{
    // This reads the configuration keys from the secret store.
    // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
    configuration.AddUserSecrets();
}
configuration.AddEnvironmentVariables();
Configuration = configuration;

Asp.Net 5.0 Docs -> Configuration

like image 97
Loren.Dorez Avatar answered Oct 13 '22 00:10

Loren.Dorez