13

I'm writing a .NET Core console application (NOT an ASP.NET Core web application). In .NET Framework I would have an App.config, and App.Debug.config, and an App.Release.config file, the latter 2 for transforming the former. This allowed me to change various settings based on whether I was creating a debug or a release build.

Now with .NET Core, you're meant to use appsettings.json instead. Fine, but how do I do my debug and release transforms with this? I've read something about using an environment variable to determine whether you're in a release or debug environment but I really don't want to do this and it's not really appropriate for console applications anyway. So how can I transform config files in a similar way to how it was done in .NET Framework?

Jez
  • 27,951
  • 32
  • 136
  • 233
  • https://lukemerrett.com/environment-specific-configuration-in-dotnet-core/ – mm8 Nov 08 '18 at 13:55
  • Possible duplicate of [What is the equivalent of Web.config transform in ASP.NET Core?](https://stackoverflow.com/questions/46891794/what-is-the-equivalent-of-web-config-transform-in-asp-net-core) – rmjoia Nov 09 '18 at 13:33
  • I remember there being ways to manage the debug and release config in the .csproj file – Neville Nazerane Nov 09 '18 at 22:18

1 Answers1

7

The short answer that I found to this is: use SlowCheetah. It implements XDT transformations for .NET Core and in addition allows JSON transformations too with JDT.

Jez
  • 27,951
  • 32
  • 136
  • 233
  • here is a demo https://github.com/d668/NetCoreConfigTransform/ .NET Core 2.2 Console app App.config transforms using slow-cheetah – Toolkit Aug 02 '19 at 12:14