Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to handle debug/release config transformations in ASP.NET vNext

$
0
0

In previous versions of ASP.NET many of us used Web.Debug.config/Web.Release.config files trasformations that would look something like this:

Web.config:

<connectionStrings><add name="AppDB" connectionString="Data Source=(LocalDb)\\..." /></connectionStrings>


Web.Release.config:

<connectionStrings><add name="AppDB" connectionString="Data Source=(ReleaseDb)\\..."  xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/></connectionStrings>

As per ASP.NET vNext tutorial you still can use Web.config. But config.json appear to be the new way to handle configurations now as per the same article:

config.json

{"Data": {"DefaultConnection": {"ConnectionString": "Server=(localdb)\\..."
        }
    }
}

And in Startup.cs:

var configuration = new Configuration();
configuration.AddJsonFile("config.json");
configuration.AddEnvironmentVariables();

So I'm wondering what would be the suggested way to handle config-transofrmation with this shift to json?

p.s. I've also added the same question on StackOverflow


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>